[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Where Tcl and Tk went wrong
- From: Javier Guerra Giraldez <javier@...>
- Date: Wed, 31 Mar 2010 13:03:22 -0400
On Wed, Mar 31, 2010 at 12:52 PM, steve donovan
> On Wed, Mar 31, 2010 at 6:46 PM, Javier Guerra Giraldez
> <email@example.com> wrote:
>> if all you want is encapsulation, polymorphism
>> and nice syntax, then you don't need any of "several competing
> OK, but you have to get into metaprogramming fairly quickly - and from
> that sentence, I don't know which Lua OOP model you're thinking about
> ;) It's probably the standard 'metatable.__index == metatable' but
> maybe not....
the beauty is that it doesn't matter! as long as your 'methods' are
functions that accept the 'object' as the first parameter, and are
accessible with table lookups (either directly, or with metatables),
you can use the obj:mth(parms) syntax.
that's why i don't buy the "we need to standardize!" cries. all of
the 'extra' "OOP models" support this syntax, making interoperability
mostly seamless. and useless too, since i still haven't seen one that
gives any real advantage. i find far easier to do it by hand in the
very (very) few places where i've needed some inheritance. in most
cases simply using the module itself as the 'class' even takes most of
the metatable handling out of sight.