Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72091 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85755 invoked from network); 3 Feb 2014 17:29:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 17:29:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 74.125.82.172 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:57531] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/28-35654-3E1DFE25 for ; Mon, 03 Feb 2014 12:29:08 -0500 Received: by mail-we0-f172.google.com with SMTP id p61so2664285wes.31 for ; Mon, 03 Feb 2014 09:29:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IbdfcoDIMegv6G8IvG8LGxbPWWMgP6i53ve70NEEV4g=; b=miiEhKz6lokqAR825eqcrpYJ6I40XfFFZZSfIx7+pa6QGQtbu3uuF2cz8XndvZf2B3 FBkRIacRT2qEPgRowdSOt9FqVlgU3KXr7rBPR8rdu0VYfS6tWzNCh02vkMhYfMlqwu0s Ll2CuXll3pEjunzdhRLDQ6p9+pMVLexDiswSwslRKWWUwTKtvatXP7ZOn0FtMU13Q20j HlVECagsdikbqRMXaxLi2qz7WP7L90xN37jH0esFS1Bu2uUyJSkcKaKTUO9E0LIe+GBP 2d+rj5PFrhT4g3ZfaUXAWSJr25XgZt4IjCLcO4haMuiF+1IbpSHAooYuxChIlvyt7/CU IJNA== X-Gm-Message-State: ALoCoQmJReNUeNaTdsKC//Wgdf+BkjNq40USD91y67FiQDKHSvPUkl4eXPZf5NsZN7XLbA0qGdaPkBaHoeelquunp/ri+K8BTbf/aG43Ms+g59YuGRRvsY8YSjDW7pzgT3Smd5OjdW+G MIME-Version: 1.0 X-Received: by 10.180.189.169 with SMTP id gj9mr9525962wic.17.1391448545214; Mon, 03 Feb 2014 09:29:05 -0800 (PST) Received: by 10.227.91.196 with HTTP; Mon, 3 Feb 2014 09:29:05 -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 21:29:05 +0400 Message-ID: To: Stas Malyshev Cc: Joe Watkins , PHP internals Content-Type: multipart/alternative; boundary=001a11c34a6242dbcd04f183dc25 Subject: Re: [PHP-DEV] RFC: expectations/assertions From: dmitry@zend.com (Dmitry Stogov) --001a11c34a6242dbcd04f183dc25 Content-Type: text/plain; charset=UTF-8 Hi Stas, In main opinion, the main advantage of the proposal is ability to use of assert() function in production code with zero cost. It might be important, because cost of the assert() call and condition evaluation might be expensive. It's similar to C which provides assert() function, but near every project defines ASSERT macro anyway, to eliminate assert() calls for release build. Thanks. Dmitry. On Mon, Feb 3, 2014 at 12:38 PM, 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. > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11c34a6242dbcd04f183dc25--