Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71286 invoked from network); 4 Feb 2014 22:54:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 22:54:02 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.173 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.173 mail-lb0-f173.google.com Received: from [209.85.217.173] ([209.85.217.173:61663] helo=mail-lb0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/97-13782-88F61F25 for ; Tue, 04 Feb 2014 17:54:01 -0500 Received: by mail-lb0-f173.google.com with SMTP id y6so6961061lbh.18 for ; Tue, 04 Feb 2014 14:53:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=eWKasolEg3t1+gn00LTap013rhe5Pm5Fsn9MkHpmGok=; b=U4ZkqKBXiuJRmIGBXCoxGRnUnlWtukVlYqeFWOBv0H8n8sqnWIxkRMPMsTF2Ze9I1U +FQEqBgLKNqmVIJFjZp8p0/j5F+d9JU54ninSQn7C7UU1iUP8YubGdgi8lGZm4OuMIbX qAyVBbrjB7vYZ01I4J5jMz48ZTqolRRN9UI2JFAa/Usm1REJ0OSaTqJCnHejtSc35GWe qVVbN3q61VbsK+dk/zGVYNDboBBWq/s225kOWFwOBSyMgC51yGlHQh/xD/D0YTrhCPLI ohs4qB73+1fibETviU9iSRKodPYit5BPsjDcu/gyEzquKQvWrQEbU5PADLjueWIfndSj YyLw== X-Received: by 10.112.160.200 with SMTP id xm8mr5322698lbb.24.1391554437453; Tue, 04 Feb 2014 14:53:57 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Tue, 4 Feb 2014 14:53:17 -0800 (PST) In-Reply-To: <52F15FD6.7060901@ajf.me> References: <52EE2B66.4040005@pthreads.org> <52F157BE.3020804@ajf.me> <52F15FD6.7060901@ajf.me> Date: Wed, 5 Feb 2014 07:53:17 +0900 X-Google-Sender-Auth: 3MjtNNTiiTuNSYmYqY1_43e8GV4 Message-ID: To: Andrea Faulds Cc: Sebastian Krebs , Joe Watkins , PHP internals Content-Type: multipart/alternative; boundary=001a11c24896ee1dd904f19c8365 Subject: Re: [PHP-DEV] RE: RFC: expectations/assertions From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c24896ee1dd904f19c8365 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 5, 2014 at 6:47 AM, Andrea Faulds wrote: > On 04/02/14 21:30, Yasuo Ohgaki wrote: > >> eval() works. >> >> php > assert(eval('FALSE;')); >> >> Warning: assert(): Assertion failed in php shell code on line 1 >> php > assert(eval('return FALSE;')); >> >> Warning: assert(): Assertion failed in php shell code on line 1 >> php > >> >> However, it does not solve inconsistency. PHP code has to be string. >> Writing PHP code as string is not fun thing to do ;) >> > > That's not what I meant. At present, you do: > > assert($string); > > And that string is evaluated. A closure would be faster. Though this is > for debugging code, so I'm not sure it matters (though I, unlike some > people, might like to use assertions in production code to make sure things > fail early, fail often). I think I understood your comment. php > assert('function() {return FALSE;}'); php > assert('function() {return TRUE;}'); It does not work, but php > assert(eval('function() {return FALSE;};')); Warning: assert(): Assertion failed in php shell code on line 1 so closure in eval() works. I don't see reason not to allow closure directly. It only seems inconsistent to me. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c24896ee1dd904f19c8365--