lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jan 26, 2011 at 4:37 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Wed, Jan 26, 2011 at 7:52 PM, Peter Cawley <lua@corsix.org> wrote:
>> argument list, but this is ugly from a language design point of view,
>> as then "foo:bar(...)" becomes a special-case of redefining the
>> semantics of something which is already valid syntax.
>
> So the question would be: what is more ugly, having to live with
> different implementations of foo:bar and foo:bar(...), or not having
> any meaning for foo:bar ?
>
> Having the auto-closure available would be useful when specifying
> callbacks to object methods.
>
> steve d,

A "__colon" metamethod - that would be invoked only on the
case of the "foo:bar" without the trailing arguments - would be a
nice alternative to auto-closure, I think... some people would
like to create a new closure every time that the interpreter executes
a foo:bar, others would prefer to cache these closures somehow...
  Cheers,
    Eduardo Ochs
    eduardoochs@gmail.com
    http://angg.twu.net/