[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Function definitions in table constructors
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 21 Feb 2008 14:07:07 -0800
on 2/21/08 1:39 PM, Duncan Cross at duncan.cross@gmail.com wrote:
> On Thu, Feb 21, 2008 at 2:00 PM, Alex Davies <alex.mania@iinet.net.au> wrote:
>> It's quite an easy change to the parser, see:
>> http://lua-users.org/lists/lua-l/2008-01/msg00525.html
>>
>> The patch is a little different though - for my oo system I prefer to have
>> implicit selfs inside table functions,
>
> Perhaps the best solution would be to combine this with a second,
> independent change that takes:
>
> function :anonmethod(a,b,c)
> ...
> end
>
> as syntactic sugar for:
>
> anonmethod = function(self,a,b,c)
> ...
> end
>
> so table-constructor methods have a lightweight syntax.
But to really make it pay off one needs some way to also remove the need for
a comma after the end.
Mark