lua-users home
lua-l archive

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


On Thu, Dec 30, 2010 at 07:03:34AM +0200, Steve Litt wrote:
> Pretty cool, but I couldn't figure out a way to make x and y private 
> (at which time getx() and setx() etc would need to be added. 

Ah, those marvellous days when I was a C++ programmer!  One could
spend hours without pausing for thought, engaged in writing header 
files with declarations headed private, and providing public inline 
functions get.. and set... for every field.  Being able to expand 
what in Lua would have been
    local a,b,c,d,e,f
to eighteen lines of code was a real treat when I was paid at so
much per line.  The only horror was trying to remember the difference
between "const int f(x)" and "int f(x) const".

Just why must x and y be private if you plan to provide read and
write access to them?

Dirk