[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Short Anonymous Functions
- From: David Manura <dm.lua@...>
- Date: Mon, 23 Mar 2009 21:31:29 -0400
On Mon, Mar 23, 2009 at 12:31 AM, Geoff Leyland wrote:
> I read the wiki page on Short Anonymous Functions (
> http://lua-users.org/wiki/ShortAnonymousFunctions ;), and noticed that
> there's nothing there that proposes the approach that is (or at least was a
> few years ago) used in the Boost Lambda Library: make special argument
> placeholder objects (say _1, _2 ..._N), and overload the operators for these
> to return callable objects....
> test(_1 + 100 + _2)
That's worth adding to that page. That placeholder syntax was also
used in[1], but it was stringified.
As you've seen in the "Relational metamethods and mixed types"
discussion, it does have it's limitations though. For example,
relational operators always return true/false, and "and/or/not"
operators are not overridable.
[1] http://lua-users.org/wiki/ListComprehensions