Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72060 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16399 invoked from network); 3 Feb 2014 09:11:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 09:11:52 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.180 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.180 mail-qc0-f180.google.com Received: from [209.85.216.180] ([209.85.216.180:57306] helo=mail-qc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/27-15628-75D5FE25 for ; Mon, 03 Feb 2014 04:11:51 -0500 Received: by mail-qc0-f180.google.com with SMTP id i17so10579181qcy.39 for ; Mon, 03 Feb 2014 01:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Rh3N7/tjU85lHyVEYXMp3e/z1jp14CYt0DgKz8BaNtA=; b=F51Dr930ZvAAC1zZmYT5YPYO0jFyMZ8j2avrWzRtIBy8BDSyQdTrvD1b4no1X910Uc Yg9t3M9hfZY9M3bbk7ETNDpdx4hUG3Kl2s8skEO/FZRRfm5TdaC6ylQiooYbOizYwIIz ALDdqo6GpQQ0zu/ZJJQH2DgFA8SOKL+Blymq14G4o/NoVztFLWk2m7m99pESOG/L/Qj3 tobNfbpBRTXY9fw+DDuRfIRxeekvWG/oHiYbPZxZRLhrXjmBKSN46SMnO+drC/uDKu9S txI852NcTVWK+enLyoeSBroEfzmbnjxKRT6B+jzhe8YWhNyzEM9StCRQYc85qnN2O9Uc thDg== MIME-Version: 1.0 X-Received: by 10.224.98.212 with SMTP id r20mr54759979qan.0.1391418709022; Mon, 03 Feb 2014 01:11:49 -0800 (PST) Received: by 10.140.18.129 with HTTP; Mon, 3 Feb 2014 01:11:48 -0800 (PST) In-Reply-To: <52EF5588.6010902@sugarcrm.com> References: <52EE2B1D.7000307@pthreads.org> <52EEA7BE.4050500@sugarcrm.com> <52EEF636.7010505@pthreads.org> <52EF5588.6010902@sugarcrm.com> Date: Mon, 3 Feb 2014 10:11:48 +0100 Message-ID: To: Stas Malyshev Cc: Joe Watkins , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RFC: expectations/assertions From: pierre.php@gmail.com (Pierre Joye) On Mon, Feb 3, 2014 at 9:38 AM, Stas Malyshev wrote: > Hi! > >> Well lets not forget that we already have an implementation as part of >> the core, so to argue that we don't require assert in the core is moot; >> we already have it. > > I'm not sure what you mean. We have assert function, a function among > others. What you propose is special engine-level magic just for this > function. The difference is like having a program that runs on Linux and > does X and having special patch in Linux kernel just to do X. The bar > for the latter is much higher. > >> While you can avoid some overhead in userland, you cannot remove the >> overhead completely; a good assertion API should have no impact on >> production, none, it should require no boilerplate code to make sane use >> of it, at all, since it is meant to be a core feature. > > This is not completely fulfilled by your patch either - it still has an > overhead of having the opcodes there and doing the jumps. If the code > you're avoiding to run is heavy, then of course this overhead is > negligible compared to the code you're avoiding, but the same then is > true for purely userspace solution. > >> It would seem to create inconsistency, but only because it's compatible >> with legacy code asserting strings, if you are smart, you will not > > It doesn't "seem" to create inconsistency. It creates it. It's not like > I'm imagining two parameters doing the same thing :) > >> assert with strings and take advantage of the new implementation, if you >> are not, you will continue to assert strings and be unaffected by the >> new implementation ... that seems ideal to me, and Dmitry ... > > I don't think having a function that is half a function and half a magic > engine constraint and that is controlled by two separate settings, one > living in zend. and one in assert. is really ideal. Also, it is not true > that string parameter is the only thing that controls it - as I already > showed, how you call it also makes it work completely different and > assert.* parameters still influence it even in magic mode, leading to > such things as both throwing exceptions and bailing out - which I still > don't understand how it's supposed to work. I fully agree here. As the effort to reduce the impact of assert in production is much appreciated I do not see much needs for this "addition". I also discussed with a couple of developers being intensively involved in testing tools and framework for php and the consensus is that they do not need it for the large majority. A minority even considers this feature as not really good, assert never was a good thing to use (I never used for example). Cheers, -- Pierre @pierrejoye | http://www.libgd.org