Re: Self invoked anonymous functions with no outer scoped ???
That might prove difficult considering how much of the language is *defined* in outer scopes. (Including, er, the basic grammar.) On Fri, Dec 8, 2017 at 3:25 PM, Andy Bach wrote: > I ran into this article > https://medium.com/@kasperpeulen/an-interesting- > programming-feature-that-no-language-has-except-php-4de22f9e3964 > > The feature allows [you] to write *self invoked anonymous functions that > don’t let any scope from the outer function leak in*. The syntax he > proposes involves the *use* keyword, followed by explicit parameters, > which is followed by a block that can use those parameters and return a > value. > > But I don't quite (er, okay, at all) understand what the point is. Just > curious if P6 has anything along this sort thing. > > -- > > a > > Andy Bach, > afb...@gmail.com > 608 658-1890 <(608)%20658-1890> cell > 608 261-5738 <(608)%20261-5738> wk > -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
Re: Self invoked anonymous functions with no outer scoped ???
Let's say this keyword throws away everything in the lexical scope, except for what you declare sub compute-G (\a, \b, \c) { my \d = only-use ( a, b, &infix:<+>, &infix:<*>, &infix:<**> ) { a + b * 2 ** 3 } … return g; } I think that would get old real quick. On Fri, Dec 8, 2017 at 2:25 PM, Andy Bach wrote: > I ran into this article > https://medium.com/@kasperpeulen/an-interesting-programming-feature-that-no-language-has-except-php-4de22f9e3964 > > The feature allows [you] to write self invoked anonymous functions that > don’t let any scope from the outer function leak in. The syntax he proposes > involves the use keyword, followed by explicit parameters, which is followed > by a block that can use those parameters and return a value. > > But I don't quite (er, okay, at all) understand what the point is. Just > curious if P6 has anything along this sort thing. > > -- > > a > > Andy Bach, > afb...@gmail.com > 608 658-1890 cell > 608 261-5738 wk
Self invoked anonymous functions with no outer scoped ???
I ran into this article https://medium.com/@kasperpeulen/an-interesting-programming-feature-that-no-language-has-except-php-4de22f9e3964 The feature allows [you] to write *self invoked anonymous functions that don’t let any scope from the outer function leak in*. The syntax he proposes involves the *use* keyword, followed by explicit parameters, which is followed by a block that can use those parameters and return a value. But I don't quite (er, okay, at all) understand what the point is. Just curious if P6 has anything along this sort thing. -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk