Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72248 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58642 invoked from network); 5 Feb 2014 07:59:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2014 07:59:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.172 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.172 mail-lb0-f172.google.com Received: from [209.85.217.172] ([209.85.217.172:52355] helo=mail-lb0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/A3-22810-D4FE1F25 for ; Wed, 05 Feb 2014 02:59:10 -0500 Received: by mail-lb0-f172.google.com with SMTP id c11so33989lbj.3 for ; Tue, 04 Feb 2014 23:59:06 -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=jizXBTkI9eWjwPf+fdvxxHgV4BKrpSDcxoUFlqPDryM=; b=A8Fzpuyl4W9w3GTpTJliu0AEomf2ye9mEIEDOPUkfU071eipoLbAkp8En0CcZ4O4Xk qpZ1bNFIsoZbb5gPJYDePyfi+YQtwDclfjJ8KtsRNLlrjIdEwI3T/QojRABNsAzKeLqv vrcBAdqBVRtCnZPIi4Nfyyqd0vYKcg5ULIJyetp+4FdvRKoUsNU0f0RXV7IBa7+2F2Rb 32U6facGpFz/tOTlVCzrlYI4BauQGpfZwQBqHxFyEQ/5dMTR56SGq7vm0VcKBXqkwYEN R3goCs0B4zBxYC41ilrcgdctyaD/WZFJ4XmOxrwjj+DNwdDvUS5x1RFdBOZar/K4hXH8 qWWQ== X-Received: by 10.112.172.69 with SMTP id ba5mr6528lbc.55.1391587146835; Tue, 04 Feb 2014 23:59:06 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Tue, 4 Feb 2014 23:58:26 -0800 (PST) In-Reply-To: References: <52EE2B66.4040005@pthreads.org> <52F157BE.3020804@ajf.me> <52F15FD6.7060901@ajf.me> Date: Wed, 5 Feb 2014 16:58:26 +0900 X-Google-Sender-Auth: Z85F955GDMkYDW9rfsYuJE1gFEo Message-ID: To: Nikita Popov Cc: Joe Watkins , PHP internals Content-Type: multipart/alternative; boundary=001a11c234048fadef04f1a42193 Subject: Re: [PHP-DEV] RE: RFC: expectations/assertions From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c234048fadef04f1a42193 Content-Type: text/plain; charset=UTF-8 Hi Nikita, On Wed, Feb 5, 2014 at 3:21 PM, Nikita Popov wrote: > 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(){})(). Thank you for the explanation. Current assert() is consistent as its spec, since it does not support callable which is callback function. I think assert() may accept closure. As I wrote in another mail, assert(function() { // some // useful // code }); looks nicer and more modern. Users are use to this as this kind of form is extensively used in JavaScript. I wish to have this form for new assert(). Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c234048fadef04f1a42193--