lua-users home
lua-l archive

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


On Mon, Jun 16, 2003 at 09:39:48AM -0300, Andre de Leiradella wrote:
> . explicitly calling inherited methods;
> . static properties;
> . static methods.

What's the problem with using Classname.foo(self, ...), Classname.bar and
Classname.baz(...), supposing you implement OO the usual way?

Foo={}

setmetatable(Foo, {__index=Bar})

function Foo.new()
    return setmetatable({}, {__index=Foo})
end

and so on.

I think having to explicitly give the class name is a Good Thing and so
is having to explicitly refer to objects variables (be it @ or self). 
Although I rather stick to simple languages and haven't used C++ and 
such much, I think implicit OO scope tends to make code hard to read. 
If I had to write C++, I'd be using some clsnm_ prefix for the variables
to keep things clean.

-- 
Tuomo