Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Auto-Initialization
Last updated at 2:41 pm UTC on 16 January 2006
I would like to have in the kernel the fact that the initialize method is automatically called at creation time, like in CLOS. For this the Behavior>>new method should call Object>>initialize. This way we would not have to all the time write super new initialize...
Then we could called basicNew allocate because this is what it does. This way people could still obtain uninitialized instances when they want it, and the other could have automatically initialized instances.

StephaneDucasse


This idea went around on the list, and while it would be nice to have help with combining instance creation and initialization, this particular proposal has some problems that keep it from working directly:
  1. Existing Smalltalk code itself overrides #new this way; loading such code into Squeak would mean that objects in this system get initialized twice. Thus, this change is a fundamental incompatibility with standard Smalltalk.
  2. A lot of classes need parameters for initialization, and this proposal doesn't address such classes.