lua-users home
lua-l archive

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


On Tue, Sep 28, 2010 at 12:14 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
>>> 'f' and 'b' respectively. I expect b:baz() to call Bar's baz on b. But
>>> if I used f.baz(b) instead, I'm actually calling Foo's baz on b.
>>
>> I thought that was a feature ;)
>
> absolutely.
>
> every now and then there appears some project to 'free from the
> dot/colon choice', fortunately these efforts are typically short lived
>

Javier,

I would like to clarify two things:

a) The patch does not forbid you to use the classic way. And even if
you uses the REQUIRES SELF semantic (currently signalized by the
"method" keyword) you can still use the colon. In fact, the only
severe incompatibility occurs in scenarios like the example above,
that seems to be, for the OO paradigm as the "goto" was for the
structured programing. So, as in PASCAL and C the goto still exists,
the classical way should continue to address this kind of requirement
- but, like the goto - should be used with caution.

b) The patch introduces a new semantic concept to Lua. The OOBit can
represent more than an REQUIRE SELF It says that a function is a
method. What for? Lua could, for example, detect - during the
execution - if the access to an field of the self object  is being
performed inside a class method or not. This could "create a new way"
(I suppose)  to control field's visibility outside a class.

-- 
Nilson