Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72950 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54341 invoked from network); 5 Mar 2014 22:09:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2014 22:09:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.213.49 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.213.49 mail-yh0-f49.google.com Received: from [209.85.213.49] ([209.85.213.49:38244] helo=mail-yh0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/4B-32928-3A0A7135 for ; Wed, 05 Mar 2014 17:09:39 -0500 Received: by mail-yh0-f49.google.com with SMTP id z6so1783082yhz.22 for ; Wed, 05 Mar 2014 14:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NyU5ZNQTERTU928l4CS10UYYy8aD9QV78yqBhBMQC8E=; b=AL6C22kf6xpZFt8El/fBPyWklW+1Gp4CA2Zh8Ryez1JOLd3uIeBXUNZa9geOach0r0 yP3e2nTGkk4TJdDccuPB3IsNkPkEIiyYakEeTxwK207PHWZZQl/C/aYWz3m4JYMDU4QT 2FSuvprWOahlppE1q9neLItIQ9F6SMVOqQaZk= 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=NyU5ZNQTERTU928l4CS10UYYy8aD9QV78yqBhBMQC8E=; b=hxQ7L+qZbQcVvEOoP/FPIfAGQIUFeWEVBNGFEBl0sh6rpB6osGCG9Z0BeE4/JJ3gex vXOJYjSG0C6e2HUb6kfw4fHa8rNrujPdkqtCKKHfKxzxdgBIQE1SojmhArxPLjtBvwEk 0WHGiLLcdNOV74f3WHto/XxKAJNB1XvK80rbhdeQsgYK2odfClkCUh/J0632UwGYJq2X u8ROwcczmEwrBz0Paeqb+uF1Ye5v8smJHMLSbq6EPZh9TRaUZLQmoKUbmM9Wnrvv1fys Xazv7d9DcOvW8nxz2NES2HpV7Yn9Fn916bBxnmqerLfn+iXoxfe0Px0u7vKN6oVI0F7x 8fow== X-Gm-Message-State: ALoCoQmAC6AKuOm4Hop+I08jZOX58U4vEiy9QcZ4Kd+HNmOfwjx3Yi6raRyzvLUF5UPpNdOSAzHn MIME-Version: 1.0 X-Received: by 10.236.80.8 with SMTP id j8mr190153yhe.151.1394057377054; Wed, 05 Mar 2014 14:09:37 -0800 (PST) Received: by 10.170.188.139 with HTTP; Wed, 5 Mar 2014 14:09:36 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Mar 2014 00:09:36 +0200 Message-ID: To: Nikita Popov Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] T_AS in closures From: narf@devilix.net (Andrey Andreev) From what I read (and that's all of it), people on the list were against (expression) as $foo and wanted more usage examples in the RFC. The overall reception seems positive to me. :) The author withdrew it because they wanted to add more stuff to the patch and then (apparently) never proposed it again. Actually, that discussion also mentions use (...) with regular functions, which would also be nice, but probably better left for another thread. On Wed, Mar 5, 2014 at 11:38 PM, Nikita Popov wrote: > On Wed, Mar 5, 2014 at 10:28 PM, Andrey Andreev wrote: >> >> Hi, >> >> I was clicking on bugs.php.net/random today and I came across #54888, >> which is a feature request for the following syntax: >> >> $foo = 'whatever'; >> $bar = function() use ($foo as $baz) { /* use $baz here */ }; >> >> https://bugs.php.net/bug.php?id=54888 >> >> I don't know if other languages have it, but it seems nice and >> considering how much developers prefer foreach() over other loops >> because it allows them to "rename" the variable, I'm sure people would >> love it. >> >> Has this been discussed before? What are your opinions on it? >> >> Regards, >> Andrey Andreev. > > > There has been an RFC for this: https://wiki.php.net/rfc/useas > > IIRC the RFC was withdrawn because the reception was not very positive. You > might want to have a look at the discussion, see > http://markmail.org/message/q53myujswaesca2u and > http://markmail.org/message/nrptrylgkarqrpxk. > > Nikita