On 15 April 2013 00:31, Norbert Hartl <norbert@hartl.name> wrote:
Am 14.04.2013 um 21:27 schrieb Igor Stasenko <siguctua@gmail.com>:
pfff...
DateAndTime class>>initialize
super initialize.
NEVER EVER call super initialize for class initializers!
I think we should add a lint rule for that.
Can you explain why?
because if you would strictly follow that rule, then you should end up in Behavior>>initialize and your class will be reset completely: initialize "moved here from the class side's #new" super initialize. superclass := Object. "no longer sending any messages, some of them crash the VM" methodDict := self emptyMethodDictionary. format := Object format subclasses sharing all class vars declared in supeclasses. resetting them every time you creating/initializing a subclass is just waste. It only makes sense when your superclass having own class inst var to initialize. But in most cases you want to initialize them differently than in superclass (e.g. superclass ivar of your superclass should be not same as your class).
Norbert
-- Best regards, Igor Stasenko.