lua-users home
lua-l archive

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


John Belmonte wrote:
>     function mylib.MyClass:method() ... end
> 
> Let's try the "accepted syntax":
> 
>     -- oops, you can't do this!
>     mylib.MyClass:method = function() ... end
> 
> So now we're down to:
> 
>     mylib.MyClass.method = function(self) end

That was the main reason why I removed this "automatic" self.  The
other one was because of possible name collisions (btw the same reason
why I replaced the "..." with "name[]" - no magic locals anymore *g*).

> Please consider Edgar's function definition extension for Lua.

It was only one word to change (an if into a while).  And I see
no reason why it shouldn't be like that.  A similar simple change
was necessary for "x = (a or b)[foo]".

The other request like "function foo(x).y(...)" are IMHO too strange.
They cannot be parsed with an LL(n) parser (any fixed n) and are only
confusing to readers of the code (function foo(x).y:n(bar).z(baz)...).

Ciao, ET.