Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72014 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20646 invoked from network); 2 Feb 2014 20:17:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2014 20:17:07 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.67 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.67 smtp67.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.67] ([108.166.43.67:48664] helo=smtp67.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/82-30967-2C7AEE25 for ; Sun, 02 Feb 2014 15:17:07 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id D8750148175; Sun, 2 Feb 2014 15:17:03 -0500 (EST) X-Virus-Scanned: OK Received: by smtp1.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 74ACD148149; Sun, 2 Feb 2014 15:17:03 -0500 (EST) Message-ID: <52EEA7BE.4050500@sugarcrm.com> Date: Sun, 02 Feb 2014 12:17:02 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Joe Watkins , PHP internals References: <52EE2B1D.7000307@pthreads.org> In-Reply-To: <52EE2B1D.7000307@pthreads.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: expectations/assertions From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Still, there's no reason for us to have a crappy assertion api as part > of the core just because there's a way around it(-ish) in user land. I think there is some reason - if it can easily be done in userland, with more flexibility and suitability for particular purposes of the user, why put it in core? If it's such a common feature, make a PSR for it and create reference implementation that everybody would be using. So my question is - what having in core adds to it that can't be done as easily in userland? Also, it essentially splits assert() into two completely independent things one of them being regular function that you can call and another being weird magic thing. Moreover, for the same assert there's now two completely independent ways of controlling it - one is zend.assert and another is assert_options/ASSERT_ACTIVE. E.g. compare: // This is controlled by zend.assert assert($foo > 1, "Foo is too small"); // This is controlled by assert_options $f = 'assert'; $f($foo > 1, "Foo is too small"); This looks a bit strange for me. Also, assert() will throw exception if assert.bail = 1 and assert.exception = 1, but only if the argument is not a string. If the argument is a string no exception will be thrown. OTOH, if the argument IS a string, assert will both throw exception *and* bail out, which is not clear what is the purpose of that. I'm also feeling a bit uneasy with adding more and more special cases for special names in the engine. Maybe we could create some more generic facility that would not need to be one-off case for just one function? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227