Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72215 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52322 invoked from network); 4 Feb 2014 21:26:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 21:26:26 -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.176 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.176 mail-lb0-f176.google.com Received: from [209.85.217.176] ([209.85.217.176:49522] helo=mail-lb0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/D4-13782-10B51F25 for ; Tue, 04 Feb 2014 16:26:26 -0500 Received: by mail-lb0-f176.google.com with SMTP id w7so6765668lbi.7 for ; Tue, 04 Feb 2014 13:26:22 -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=tEUmlOI7kp/6TEFzMcnMyOlC6K1mdwoR0tHhSRrgXGk=; b=pur24BtuavD1fO0NF+0GkvABiaaeXKVBDZ6UAZDqB8KcRbBwJSOzbRZRurzr14IBqD TVjuabZs9fHrq+6W9khNmwlmKY/TUqawhXNKdn5dgfiKWmvscz+GP7Q8n0J+yOtGeCRO MHvwY7G5kAO/qMxH6RXtBN7S4/F/7rbxVj3QyMLw92Z1ewKkpjq3nNEiX9gz4bkYGOPW 66+Gb17KP0TLAy9O/XKNL6EJJZIwlMEmphe3xQ5q4jhnp6c0zW4k/cC+j1RrCZ/sRaoy NA5NVN01VtQcHXiEz3ZDo43TCUxfvKs7Bem5PoPWFmcV5BJ0obRXEaHyX/WPf78/yo07 qXHg== X-Received: by 10.112.134.38 with SMTP id ph6mr18689937lbb.16.1391548788226; Tue, 04 Feb 2014 13:19:48 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Tue, 4 Feb 2014 13:19:08 -0800 (PST) In-Reply-To: References: <52EF4BF8.60005@sugarcrm.com> Date: Wed, 5 Feb 2014 06:19:08 +0900 X-Google-Sender-Auth: l1nXzh76n1IiDRWJA9mwo7EGES0 Message-ID: To: Dmitry Stogov Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b3a894635bdd704f19b3342 Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --047d7b3a894635bdd704f19b3342 Content-Type: text/plain; charset=UTF-8 Hi Dmitry, On Wed, Feb 5, 2014 at 3:30 AM, Dmitry Stogov wrote: > I don't think PHP needs new language constructs for assertions. > Actually, the code from your example may be implemented as two calls to > assert(). > > assert(extension_loaded('foo'), 'You need foo module'); > assert(extension_loaded('bar'), 'You need bar module'); > > I think it's much clear then inventing new syntax. > With Joe's proposal these asserts might be completely eliminated. > And it's backward and forward compatible :) > > BTW: I didn't follow all the discussion, so I may miss some points. > Thank you for reply. Since new assert() could be eliminate runtime overheads, it may be the way to go. Regarding assert(), it seems current assert() is inconsistent for function calls. Function call works php > function f() {return FALSE;} php > assert(f()); Warning: assert(): Assertion failed in php shell code on line 1 Closure does not php > assert(function() {return FALSE;}); php > Closure is a valid expression and it should be allowed. IMO. Allowing callable as 1st parameter makes behavior consistent. Closure is useful to keep clean name space. Could you consider this for new assert? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --047d7b3a894635bdd704f19b3342--