Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:87961
Return-Path: <smalyshev@gmail.com>
Mailing-List: contact internals-help@lists.php.net; run by ezmlm
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 72243 invoked from network); 31 Aug 2015 21:05:46 -0000
Received: from unknown (HELO lists.php.net) (127.0.0.1)
  by localhost with SMTP; 31 Aug 2015 21:05:46 -0000
Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass
Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass
Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.49 as permitted sender)
X-PHP-List-Original-Sender: smalyshev@gmail.com
X-Host-Fingerprint: 209.85.220.49 mail-pa0-f49.google.com  
Received: from [209.85.220.49] ([209.85.220.49:35126] helo=mail-pa0-f49.google.com)
	by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
	id 43/54-39890-9A1C4E55 for <internals@lists.php.net>; Mon, 31 Aug 2015 17:05:45 -0400
Received: by pacdd16 with SMTP id dd16so150802421pac.2
        for <internals@lists.php.net>; Mon, 31 Aug 2015 14:05:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-type:content-transfer-encoding;
        bh=4BbbnogS5TFfshvjIhYryHQg56hMgPs5Oe6Oyl68u2s=;
        b=vU4fzSS3i8PDjJpUaP4TRhhFcL1zsdoAzym5Sf/Mse9/bdRdLCfi/98A1svpk+BvID
         LiVPzpLTnByuM2oz1/Gjfgm7i1E1ROV5NkbciaYyHB/3hlntem+wShJf3Nn4oQAEwQff
         ao00B183J2/xCL1gGAUvTPC4N/LfO1vmrPt7+1gvyTCmRFUl5/3lbPi5rZ+wyBFTtCy9
         jHonm0Y2bOobVsxye6En6lXzs9B/8nZ7DBeryIJoqGOamooxK69MLFAbDbyys1nDcwm0
         wl3wnT0BOHp4yRzyaAg7ejPZK3SF1bXq+MVGa9hJOREO+k4rVQU05XkjANL1b8VJEt4p
         qICw==
X-Received: by 10.68.168.161 with SMTP id zx1mr41032346pbb.35.1441055142582;
        Mon, 31 Aug 2015 14:05:42 -0700 (PDT)
Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48])
        by smtp.gmail.com with ESMTPSA id bc1sm14828954pbb.66.2015.08.31.14.05.41
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 31 Aug 2015 14:05:41 -0700 (PDT)
To: Bob Weinand <bobwei9@hotmail.com>, PHP Internals <internals@lists.php.net>
References: <BLU436-SMTP13020F8CE8795C628BDC665E26B0@phx.gbl>
X-Enigmail-Draft-Status: N1110
Message-ID: <55E4C19F.4060704@gmail.com>
Date: Mon, 31 Aug 2015 14:05:35 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0)
 Gecko/20100101 Thunderbird/38.2.0
MIME-Version: 1.0
In-Reply-To: <BLU436-SMTP13020F8CE8795C628BDC665E26B0@phx.gbl>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP-DEV] [RFC] [Discussion] Short Closures
From: smalyshev@gmail.com (Stanislav Malyshev)

Hi!

> I had this RFC in draft since some time, but delayed it due to all
> the ongoing PHP 7 discussions. Also we have no master branch to merge
> features in until 5.4 EOL. Thus I'm reviving this now.
> 
> Time for the first RFC targeting PHP 7.1 (assuming PHP 8 isn't going
> to be the next version ;-)):
> 
> The short Closures RFC: https://wiki.php.net/rfc/short_closures

I personally don't see much advantage in making PHP code less readable
and harder to parse. Also, "automatically use () all of the (compiled)
variables" does not look like a good idea - first, users have no idea
what compiled variables are, so the result would be unpredictable for
them, second, if there are a lot of variables in the scope (like global
scope) it would have huge performance costs for no gain.
Also, this syntax does not allow "use by-ref" which the existing syntax
does allow.

I think we already have syntax for anonymous functions and it works. The
only addition in this RFC is automatically gobbling up all local
variables, which in vast majority of use cases is not what the function
needs.
-- 
Stas Malyshev
smalyshev@gmail.com