Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14510 invoked from network); 18 Jun 2015 16:53:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2015 16:53:58 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.170 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.170 mail-pd0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:32951] helo=mail-pd0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/E8-46946-5A7F2855 for ; Thu, 18 Jun 2015 12:53:58 -0400 Received: by pdjn11 with SMTP id n11so70532464pdj.0 for ; Thu, 18 Jun 2015 09:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=qZwZo97X2D97YOgeOCp3KBJ3q17ZVEpS17GDcBOvbVM=; b=AOAXHXqd0EI9SsIH4YVmxnL0xADgWO0R8ehgW/IV7hvLFcZbhkYnGVdcp8fEqmfcJR 5LtTu2b8bFj2LsrGTdhD7nrfDrMYmmCROmcuI3JpmFo1o63Evq0uYdw3nfOqmzPbCBvS gwlT763SQqUYef9Yw99tzUO8qVn4zae4ml1BkF4TzGS+w6Pz4S/s5mCgeh/Pc/9GuhoD avgWqWgMnC7yF+j4XtZ56GqCKRnF2UPKqtR+08x7skH2AgXNhuhBkPJmSQpuOxxnY26I wus6yhJGNecEruQlzVY71rF1XwH3E8VVr0ZHrx87WF6+RDE3xo9U9QV8c7n5e1YbH4yg Kubw== X-Received: by 10.70.30.193 with SMTP id u1mr22573438pdh.59.1434646433932; Thu, 18 Jun 2015 09:53:53 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id je2sm8584451pbd.3.2015.06.18.09.53.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 09:53:53 -0700 (PDT) Message-ID: <5582F79C.7050804@gmail.com> Date: Thu, 18 Jun 2015 09:53:48 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Kevin Bradwick , internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC - making the Exception class abstract From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Too many times have I seen developers throwing Exceptions when what they > really needed was something that gave it context like > InvalidArgumentException or RuntimeException. Yes, I agree this is > something to tackle at code review (and I do) but I feel PHP doesn't help > the situation by making it an instantiatable class. I struggle to think of Indeed, it doesn't - but PHP doesn't have to be helpful for 100% of every use cases. It is plain impossible as some of them are in direct contradiction. Example - one use case is yours, maintaining a code standard in a project with strict guidelines. Another - making a langugage that is easy to use to most unsophisticated user for quick prototyping. Where concerns about strict exception hierarchy may be well below concerns of developer convenience and productivity. Thus, in one case you may not want to use Exception and in another Exception may be all you need. The conflict can be resolved very easily - leave Exception as is and introduce a policy using one of the multitude of great code style tools available for the complex project. IMO it's much better than creating a huge BC break that excludes one of the use cases. -- Stas Malyshev smalyshev@gmail.com