Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69659 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37706 invoked from network); 17 Oct 2013 21:42:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2013 21:42:51 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:38152] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/00-37238-9D950625 for ; Thu, 17 Oct 2013 17:42:51 -0400 Received: by mail-wi0-f170.google.com with SMTP id l12so1557732wiv.3 for ; Thu, 17 Oct 2013 14:42:47 -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=vikKE2w6g/GzubWvMJLuwU8rQnxVOGu5TYf5Mn8iqoo=; b=ZEE3QS1dPXzcrFQ7La0jWrAjDd4JRKq7hlfapOeap4xqlT26doALfU1aX6MxzHgHLI GVyrtKBKJ1ffMV98eTDLWbJHUDYNeJt5njHec53SzghdeC7vCWqSt5kDmb9TjHig0roa MN7hAbcvFJi9eaLlAF2vJiiS7dlOMhzt9vx/Fr2iLlCFNu+v/hX4xy5RbpWXNSOC9w16 mKKLzQHJcg0V5+lOoi2gjwmCqdNyAV/4mrycF7t5deLgtoKlTKSiJYlxsZl8vnaNDYx3 r0T4fTW2xJ3kbtE9yXW7n5ebnSNIDNE1XLIH9D4SHJZo91CDNXLABITvbZUDBaAkYhK0 5aHw== X-Received: by 10.180.189.205 with SMTP id gk13mr316360wic.12.1382046167432; Thu, 17 Oct 2013 14:42:47 -0700 (PDT) Received: from [192.168.0.2] (cpc19-brig17-2-0-cust25.3-3.cable.virginmedia.com. [81.101.201.26]) by mx.google.com with ESMTPSA id jf2sm20424524wic.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 14:42:47 -0700 (PDT) Message-ID: <526059D2.5080109@gmail.com> Date: Thu, 17 Oct 2013 22:42:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <525FC834.4060501@php.net> <1534105.bNC2os93J1@rofl> <525FDAC3.6060103@php.net> <52601C6A.6020408@php.net> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Assertions From: rowan.collins@gmail.com (Rowan Collins) On 17/10/2013 18:39, J David wrote: > On Thu, Oct 17, 2013 at 1:20 PM, Joe Watkins wrote: >> >The new implementation doesn't_require_ that you control the flow of >> >execution but_allows_ you to, better than callbacks did. > Does this new exception derive from Exception? (Hint: It does.) Reading through the discussion, I think this point may deserve more prominence: the problem with throwing an exception is that it is possible (and probably quite common) to have a catch block which catches *all* exceptions. Throwing an exception from assert() tangles up any handling you did want to do for failed assertions with the presumably rather different handling you want to do for runtime exceptions. The current implementation allows you to define a callback, and to choose whether assertions are fatal, which means that unit test frameworks and fancy-output wrappers can intercept assertions *without affecting other parts of the code*. The only way to do that with catch blocks would be to have an exception which didn't descend from Exception. -- Rowan Collins [IMSoP]