Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72243 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45705 invoked from network); 5 Feb 2014 06:55:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 06:55:38 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.212.179 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:42432] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/E1-22810-860E1F25 for ; Wed, 05 Feb 2014 01:55:37 -0500 Received: by mail-wi0-f179.google.com with SMTP id hn9so226904wib.6 for ; Tue, 04 Feb 2014 22:55:34 -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=5oPDPB4rUbg2yVyuRqZhQx9pXnYGphKUPURDYsTwI3I=; b=agtRqzSJlrTTHmXcd3YHpARaeqGUSXZtX2BNzsptlC4CEORIfYudq25MZT5Y5Q5a42 VErL81QR9h3mPWwqOWT4nlxE6YD57GNi/B38LcwQ4LktdAkNDpa0JwLJKs50Ixsthj1A PM8R/Qxo7U+7SFa0/Akzdc79Kp70drpzdEv8uj5Q1FJddj9fvwk7Pzn5LU+eAnYg8Y+c 505r+QnJokEWea6EBRbggH9M8DluPv6Bcfrm+MftNoG4iMmCRRpXo8uXm2jWlumEUaJX F6HrZYOC5ATFixg3s4msTWS0sV2y+eh7Wvnv6Irn684NQfRVkK47ZovisHM22WFeuirR kU+w== X-Gm-Message-State: ALoCoQmbXAtO2wPWEDvXH6U7nV4ekq6hGzeBp8a0zz/7sZTg32EyOFauaoXDPrh44dldPCkPMl8XdbNccrGoblTQOFtkbyE6PT+Md4m4UFS80mWr9kWFkHuK0M4ydC/3LB5mFTsXz+og MIME-Version: 1.0 X-Received: by 10.180.24.227 with SMTP id x3mr1130347wif.41.1391583334259; Tue, 04 Feb 2014 22:55:34 -0800 (PST) Received: by 10.227.91.196 with HTTP; Tue, 4 Feb 2014 22:55:34 -0800 (PST) In-Reply-To: References: <52EE2B66.4040005@pthreads.org> <52F157BE.3020804@ajf.me> <52F15FD6.7060901@ajf.me> Date: Wed, 5 Feb 2014 10:55:34 +0400 Message-ID: To: Nikita Popov Cc: Yasuo Ohgaki , Joe Watkins , PHP internals Content-Type: multipart/alternative; boundary=f46d044283b050637104f1a33eb6 Subject: Re: [PHP-DEV] RE: RFC: expectations/assertions From: dmitry@zend.com (Dmitry Stogov) --f46d044283b050637104f1a33eb6 Content-Type: text/plain; charset=UTF-8 exectly :) Thanks. Dmitry. On Wed, Feb 5, 2014 at 10:21 AM, Nikita Popov wrote: > On Wed, Feb 5, 2014 at 4:11 AM, Yasuo Ohgaki wrote: > > > Hi all, > > > > On Wed, Feb 5, 2014 at 7:53 AM, Yasuo Ohgaki wrote: > > > > > 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. > > > > > > > Added this to inconsistent behaviors RFC to track. > > > > https://wiki.php.net/rfc/inconsistent-behaviors#assert > > > > There is a difference between f() and 'f'. The former is a function call, > the latter a callback. The eval-behavior non-withstanding assert is > essentially if (!$arg1) { error($arg2); }. So if (!f()) { ... } makes a lot > of sense, but if (!function() {}) {} makes zero sense. Again, function() {} > only creates a callback, but does *not* run it. To run it, you'd need > something like (function(){})(). > > There is no inconsistency here. Allowing callables in general is not > compatible with the existing string-eval mode and the expectation that > arrays will assert true if they are non-empty. Adding only closures, *that* > is inconsistent. > > Nikita > --f46d044283b050637104f1a33eb6--