lua-users home
lua-l archive

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


On Sun, 2005-01-30 at 05:28, Adrian Sietsma wrote:

> > class A
> > 	function A(name)
> > 		self.name = name
> > 	end
> > end
> > 
> > class B extends A
> > 	function B(name)
> > 		super(name)
> > 	end
> > 
> > 	function toString()
> > 		return name
> > 	end
> > end
> > 
> > b = new B('me')
> > print(b.toString())
> 
> why put it in the core ? that's what the library mechanism is all about!

The argument is aesthetic, and that is important.
Andre wants something that looks OO like, because naive
users (his clients) will be using it. It isn't enough
for the code to 'work like' OO, it has to look like it too.

However, there is a difference between adding some
sugar to the parser, and changing the core. The parser
is just one function of the core. It may also be
some other core support (virtual table dispatch or
whatever) is also useful, and perhaps the hooks and
debugging stuff will need to be changed a bit to maintain
the appearance of OO'ness.

In particular, encapsulation is probably mandatory
for Andre -- he would not want his clients messing
up the base classes the provides for them to extend.


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net