Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69644 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5237 invoked from network); 17 Oct 2013 17:39:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2013 17:39:34 -0000 Authentication-Results: pb1.pair.com header.from=jdavidlists@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jdavidlists@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.171 as permitted sender) X-PHP-List-Original-Sender: jdavidlists@gmail.com X-Host-Fingerprint: 209.85.223.171 mail-ie0-f171.google.com Received: from [209.85.223.171] ([209.85.223.171:63827] helo=mail-ie0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/53-12663-4D020625 for ; Thu, 17 Oct 2013 13:39:33 -0400 Received: by mail-ie0-f171.google.com with SMTP id tp5so4420267ieb.2 for ; Thu, 17 Oct 2013 10:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=4yB5VdRdRuOVfMliQzN2l6GeA4cldLqGKS/334iegz0=; b=udtti/i64OrN4qb/LpEBkB+lIHSsE9bnIvq+EE8JvyxnrXjPKurXUBRZGlUXE7+aLX THTxcQIaMdimeHpreK53J5zQdXU7O/S/h9y/K8tzXq4C4RP7t7JZJp1EhtiwlkU1bWFQ BroMoiMIgVRJQJiqfJnb7BuYYPQyOmIAGJDOIpdVaza0cbRBpM2swWWbZbZ4IjYU4P0u MpyuvaSnVOlzgwJx3npNPm/7Mc5mmnMBcvRLTSkSIYbDZXmZNZGargII5NpQ2w3gr+8k joK/y+K9cl9+4pHmL1rcVtMm7TbaRch2a9zU3whTwN+wXu21LMJAF4wIuc2L09qRSH8c +2aw== MIME-Version: 1.0 X-Received: by 10.42.189.132 with SMTP id de4mr6137322icb.35.1382031569246; Thu, 17 Oct 2013 10:39:29 -0700 (PDT) Sender: jdavidlists@gmail.com Received: by 10.43.180.131 with HTTP; Thu, 17 Oct 2013 10:39:29 -0700 (PDT) In-Reply-To: <52601C6A.6020408@php.net> References: <525FC834.4060501@php.net> <1534105.bNC2os93J1@rofl> <525FDAC3.6060103@php.net> <52601C6A.6020408@php.net> Date: Thu, 17 Oct 2013 13:39:29 -0400 X-Google-Sender-Auth: SXgazSrWD6UxJQ7kgBG_vTIRq7w Message-ID: To: Joe Watkins Cc: PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Assertions From: j.david.lists@gmail.com (J David) 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.) Is it caught by set_exception_handler() ? Then it requires you to control the flow of execution. > It is not practical to try and implement assert() as we know it in C, an > aborted PHP program is not useful to the user, Assertions do not abort programs in front of the user, because they are turned off. They abort programs in front of the developer. > there is no coredump, there > is nothing useful we can do other than pass control of execution back to = the > program where it is prepared to deal with it =85 The suggestion to have assertion failure generate an exception-like stack trace was an excellent one. The "PHP core dump" idea was pretty cool too, though one can only imagine how much work that would be. Beyond that, you are essentially arguing to remove assert() entirely, since the functionality you describe already exists. It's called throwing exceptions and the presented rationale for redefining language features to create new ways to throw them is unsatisfactory to me. It's hard not to notice that the fundamental question keeps getting avoided: if this is the behavior you want, what's wrong with throwing an exception? What new capability is being created that justifies changing the language and sacrificing the old capability? Thanks!