[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Where Tcl and Tk went wrong; {SPAM?} Re: Where Tcl and Tk went wrong
- From: Aleirade <aleirade@...>
- Date: Thu, 1 Apr 2010 09:45:14 -0300
--------- Mensagem Original --------
De: Lua list <lua@bazar2.conectiva.com.br>
Para: Lua list <lua@bazar2.conectiva.com.br>
Assunto: Re: Where Tcl and Tk went wrong; {SPAM?} Re: Where Tcl and Tk went
wrong
Data: 01/04/10 06:32
> On Thu, Apr 1, 2010 at 12:18 AM, Vaughan McAlley <ockegheim@gmail.com>
wrote:
> > Do you mean when objects of different schemes try to talk to each
> > other?
>
> Specifically when you try to inherit from a 'class' that is
> implemented by a different scheme. ('class' in quotes because the
> concept is not basic to Lua)
>
> > newObject = setmetatable( {}, { __index = parentObject })
Sure, but it isn't readable nor efficient. And those are important things in
a language to use in gameplay scripts, in which Lua fits (almost) nicely.
Andre
> That's one scheme; your class is a metatable, which has a 'fallback'
> __index pointing at the parent class, giving you an inheritance chain.
> This can hurt performance, so there's also 'fat metatable' inheritance
> where the base class members are copied into the metatable. Classes
> get a little fatter, but assuming that there are many more objects
> than classes this is a fine trade-off.
>
> If the number of objects of a given class are small, then
> closure-based classes are faster but you pay more per object.
>
> But if the 'class' is a metatable, then the inheritance chaining
> method should work with it.
>
> steve d.
>
> http://lua-users.org/wiki/LuaClassesWithMetatable
>
>
________________________________________________________________
Mensagem enviada pelo Microlink Webmail 12.7.8p3