lua-users home
lua-l archive

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

> Personally I think that self.something() / self.super.something()
> is clearer than 'something' implicitly coming out of the class's
> namespace.  A standardised object mechanism isn't likely to address
> such personal preferences.

I'm not much good at this OOP stuff. I think I was supposed to learn C++ 
many years ago, but I found that the size of C++, combined with its visual 
absurdity (aka unreadability), made me sceptical. The self-righteous tone 
of Mr Stroustrup's books (is it just me, or is his prose about as 
readable as Military Discipline Code?) just made it harder for me to want 
to bother. So I am learning "modern" OO with Lua,

I recently wrote a Lua function like this:

local function process(self,conn)
    self.count = self.count+1
    --some more housekeeping stuff

    --some more housekeeping stuff
    self.count = self.count-1

Ignoring the probably-crap use of sockets and mutices, and ignoring the 
ignorance of the coder leat from a syntactic point of view, 
I thought this was a model of clarity. "What is it about self that Sir 
does not find informative?"