Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83307 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12629 invoked from network); 20 Feb 2015 14:55:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 14:55:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=cryptocompress@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cryptocompress@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.179 as permitted sender) X-PHP-List-Original-Sender: cryptocompress@googlemail.com X-Host-Fingerprint: 74.125.82.179 mail-we0-f179.google.com Received: from [74.125.82.179] ([74.125.82.179:34224] helo=mail-we0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/19-54878-5EA47E45 for ; Fri, 20 Feb 2015 09:55:34 -0500 Received: by wesq59 with SMTP id q59so6116701wes.1 for ; Fri, 20 Feb 2015 06:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=TjFesawcZdb08yOwlOdo6AOFkFyvikQZ/tdUdpYB71E=; b=TBaa59ZPqrD0sHJFSaNw0YJYVPResTnOlNHh25Nc0wmBvzMabEIrkK/RPzw20b2nof isNpS6XZ5+0NRCfCJeDcPJ5t6CXlkigQ/PVgvu4IGkB75uT8o5fOvCwrxQNGvgqTr6ga wdS9UncKip+I5x+EsassDQKu8lSw9+ZaDHUUsfnPeOyK9TWf8ufqdGqWfh1ENyd2HJdf P3nEt/LvMtx6i32HEVcycsM2Rbwz5nS4n8dm+yoF1pJfei68QPFsKv/oqMfou68lubTb LGe3mrVLgw2fjZT9jTC1UnqoawWYcB/jA0axXOWpCRMilOFpu26xRiP3wEk1ncJbJ3C/ kbiQ== X-Received: by 10.180.105.131 with SMTP id gm3mr14558523wib.11.1424444129925; Fri, 20 Feb 2015 06:55:29 -0800 (PST) Received: from [192.168.1.115] (mnch-5d858289.pool.mediaWays.net. [93.133.130.137]) by mx.google.com with ESMTPSA id a1sm42400040wjs.40.2015.02.20.06.55.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Feb 2015 06:55:28 -0800 (PST) Message-ID: <54E74ADF.9040608@googlemail.com> Date: Fri, 20 Feb 2015 15:55:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: PHP Developers Mailing List References: <54E5F77D.9090406@fischer.name> <54E6F48A.9040906@fischer.name> <54E72FE7.9030803@googlemail.com> <54E7312D.9090404@googlemail.com> <54E73E70.5020403@googlemail.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------070108010606050502030702" Subject: Re: [PHP-DEV] [VOTE] Expectations From: cryptocompress@googlemail.com (Crypto Compress) --------------070108010606050502030702 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Am 20.02.2015 um 15:09 schrieb Nikita Popov: > On Fri, Feb 20, 2015 at 3:02 PM, Crypto Compress > > > wrote: > > > AssertionExceptions are not intended to be caught, they are > intended to be seen, in a specific environment. > > > Joe, your argumentation is around how (not) to use exceptions. I > can see your point and it's valid. > My point is about not to implement exceptions at all. > > If exceptions are not intended to be caught, they don't need to be > thrown (even if the context is different). > If exceptions are not thrown and not caught, we can use "error" in > dev and some easing severity (warning, zero cost nothing) in prod. > > Freely adapted from Murphy: If assertion exception can be catched, > it will be even in production. > > > The point behind AssertionException is that > a) It will leave the scope where with the failed assertion > immediately. A warning would continue running the code, even though > some precondition is violated, which doesn't make sense. Assumed context is wrong here. - exception in development: error - no exception in production: warning, zero cost nothing Rephrased: A zero-cost non-existing exception would continue running the code, ... In a previous email you brought up the point if or not derive AssertionEx from Exception. I argue that all child exception MUST BE derived from Exception. Any exception to this is not an Exception. (my english is too limited to explain this, sorry) > b) It can still be gracefully handled (unlike a fatal error). E.g. the > unit testing framework can catch it, so you can continue running all > your tests even if one causes an assertion failure. Unit test frameworks do this already. No change here. > When Joe says "not intended to be caught" this is referring to > "normal" code. Catching them at the top-level still makes sense, e.g. > for the unit testing case mentioned or even just to print a nice error > message with extra information. Using an exception instead of a fatal > error also means that things like "finally" will still run, so your > code can still release locks etc even if an assertion failure occurred. In production this will never happen. We go round in circles here. I am aware of you preference on "exceptions everywhere". > > Nikita --------------070108010606050502030702--