Re: [RFC] [Discussion] Short Closures

From: Date: Tue, 01 Sep 2015 07:41:39 +0000
Subject: Re: [RFC] [Discussion] Short Closures
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-87978@lists.php.net to get a copy of this message
On Tue, Sep 1, 2015 at 9:36 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > Hi Anthony and Bob, > > On Tue, Sep 1, 2015 at 2:53 PM, Anthony Ferrara <ircmaxell@gmail.com> > wrote: > > Most programming languages today have a "short form" closure or lambda > syntax > > > > HackLang: ($x) ==> $x + 1; > > C++: [](int x) -> int { return x + 1; } > > Java: (int x) -> x + 1; > > Python: lambda x: x+1 > > Ruby: lambda |x| { x + 1 } > > Rust: |x| x + 1 > > JavaScript (ES6): x => x + 1 > > C#: x => x + 1 > > Objective C: ^(int x) { return x + 1; } > > Nice summary! > The syntax may look strange at first, but proposed syntax is close enough > to > other languages. There will be no barrier for our users in the long run. > > I thought scope variables enabled by default is destructive at first, > but Bob clarify > they are passed by value. Therefore, it would not be issue. > > Bob, is there reason not to use the same syntax as Hack "==>"? > https://wiki.php.net/rfc/short_closures#symbol_choice -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#87978) next »