[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: RES: Cryptic OOP syntax
- From: PA <petite.abeille@...>
- Date: Mon, 31 Jan 2005 19:24:40 +0100
On Jan 31, 2005, at 20:10, André de Leiradella wrote:
It's not a proposal, just a common syntax.
Evil I say! :P
I'd like too to have multiple
constructors in Lua as it is dynamic typed (it get's too confusing
inside the only constructor to compare all possible combinations of
arguments to decide how to instantiate the object).
You can use different factory method names:
b = B.new( 'me' )
b = B.newWithNumber( 1 )
b = B.newWithBoolean( true )
The main point being _not_ to introduce any unnecessary new 'new'
keyword as you can achieve the exact same effect with a factory method.
One less thing for your user to remember :))
PA, Onnay Equitursay