lua-users home
lua-l archive

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


Brian Hagerty wrote:
> Javier Guerra wrote:
>> and what would be the advantage of doing it your way?
>> 
> 
> Two advantages, of tenuous merit.
> 
> I believe my suggested implementation of self would (slightly)
> improve function call performance by obviating the need to push an
> extra "hidden" argument on the stack.  This is based on my belief
> that typical function call implementations already contain the
> calling object's / caller's reference in the larger call frame.  That
> is, the "self" information is already on the stack, if not in the
> argument list. -- So this is not much of a performance hit in any
> case.       
> 
> The other "advantage" is really the religious point about style.
>   And that is that the language could be more uniform without the
> colon operator -- i.e. "even more austere".  But that's not really an
> advantage, that's a choice about style and (highly  
> subjective) readability.

As others have already mentionned in many cases the self information is
not available, but I guess your insistence won't suffer any objection
unless you try to implement your solution and figure out by yourself why
it don't work.

However I just spent an hour reading this flame war, so I should try my
best to make this sterile discussion end. Here are my 2 cents :-)

Your proposition simplifies syntax, and thus reduce Lua's expressivity
(that's a big disadvantage for some of us). It will break some semantics
(remember that Lua enforce almost no semantic on its syntax). Especially
it will break some semantics typically used by Lua OO systems to
implement inheritance, like LOOP does iirc. I believe that OO is
sometimes very nice, and I think your proposition to enhance Lua OO
aspects may just make any implementation of OO in Lua extremely tricky
if not impossible. But hopefully I also believe it's not possible to
implement your proposition easily.