[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: little questions -- and lua toolkit
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 13 Nov 2009 12:37:04 +0200
On Fri, Nov 13, 2009 at 12:25 PM, spir <email@example.com> wrote:
> Ok, I will experiment with this. Do you mean name clashes; or maybe the lua equivalent of method lookup complications? >Probably would opt for the explicit way... until I have an OO framework to make things clear.
People would get used to saying list:concat() for any table, and then
be disappointed when a object doesn't understand concat()!
> This is the point I don't get about metatables. How comes that lua does not "see" a method I _explicitely_ put on an object?
Ah, because it is _not_ an ordinary method! Lua does not ask 'does
this object have a __tostring() method?', it asks 'does this object
have a metatable with a __tostring() function?' But the confusion is
easy to make. First, in most OOP languages you override the
toString(),tostring(), whatever method. Second, in Lua we also use
metatables for storing methods.
> There, we could expose and comment various code snippets, evaluate them according to different criteria such as clarity, performance, etc. The main point beeing not to reinvent the wheel *worse*.
> What do you think?
Well, I agree! In fact a lot of people agree:
The LuaSnippets project is coming on, but under the overall banner of
a LuaForge replacement project. We are waiting for Andre to come back
from holiday ;)