lua-users home
lua-l archive

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


On 13 July 2017 at 15:06, Enrico Colombini <erix@erix.it> wrote:
> On 13-Jul-17 15:48, Dibyendu Majumdar wrote:
>>
>> I find that even with Lua, when I am exposing an API - I need to make
>> it OO for the user else user has to manage state and call functions
>> with potentially large number of arguments which just doesn't make
>> sense.
>
>
> You can easily do encapsulation in Lua, for example using modules as
> 'objects' with private functions/data and a public API. Of course
> polymorphism is there by default.
>

I find that it is better to ensure the OO syntax - i.e.:

object:method()

As this gives an immediate check on valid operations for each object /
class type.

Sure this is easy enough to do in Lua - and I do it all the time. But
for many people an explicit class definition syntax appears to be
attractive - I am not one of those people, but that is what I see.

Regards
Dibyendu