[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    RE: Lua with OOP, and direct member accesses
From:       "Vincent PENQUERC'H" <vpenquerch () cr2a-di ! fr>
Date:       1999-11-23 16:39:45
Message-ID: 616ABE867643D311A6D800609790405D042A8D () mougins ! sophia ! cr2a-di ! fr
[Download RAW message or body]

>> I have a little issue with implementing OOP with Lua. The
>> partcicular topic here is how to access a member of an
>> object ala C++, that is without having to prepend the self.
>> string before the actual member name.
>I know that issue. I decided to keep the self, after trying
>the approach below ;-)
 
Oh well ... :)

[...]

>So, provided classX has the tag for which the above
>tagmethod is set as settable, each definition
>  function classX:methodY (arg1, arg2) ...
>gets wrapped with by a closure that takes care of the currentObject.
>Looks clean to me, but the overhead may not really be worth the
>optical improvement.

Nice indeed. Since I am not very comfortable with closures, I
did not see they could be of use here. I am not sure I fully
understand your sample yet, I'll spend some time rereading it :)
Thanks a lot Stephan!

--vp

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic