lua-users home
lua-l archive

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

> class BonusAccount, Account do
> 	function getBalance()
> 		print("BonusAccount.getBalance()", self.balance * 1.2)
> 		return base.getBalance() * 1.2
> 	end
> endclass
> Any o(pi)nions?!
I probably wouldn't use this myself becuase I have my own class system that I use. However, since you asked for opinions:
1) I don't like the 'do' keyword there. Function definitions don't have one, so why have one for classes?

2) If you're modifying syntax, I personally prefer Ruby's syntax for showing inheritance during class definition:

class Foo < Bar

What you have there looks like you're defining two common classes at once or something.

3) endclass? Feels like a very hacked-on approach. 'end' is the way to go, if you could make it happen.