About KCP and automatic initialize

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Sep 10 04:51:58 UTC 2003


Torge Husfeldt <torge.husfeldt at gmx.de> wrote:
	Here is the sUnit test that comes along with the above change,
	preventing anybody from accidentally implementing super new
	initialize again.
	
I hope it doesn't prevent people *deliberately* doing it.
- They might be trying to write code that will port to another Smalltalk.
- They might be overriding a super that does something else.

Object subclass: #Hairy
  class methods
    newFor: aNode
      ^self basicNew initializeFor: aNode
    new
      ^self newFor: self defaultNode

Hairy subclass: #Legs
  methods
    initialize
      length := 2.
  class methods
    new
      ^super new initialize

I think it's clear that super new initialize _should_ be allowed here.



More information about the Squeak-dev mailing list