[squeak-dev] Self new in arrowPrototype

Rodney Polkinghorne rodneyp at physics.uq.edu.au
Fri Jun 3 06:21:37 UTC 2011


The arrowPrototype class method of PolygonMorph looks like this:

arrowPrototype
	"Answer an instance of the receiver that will serve as a prototypical arrow"

	| aa |
	aa := self new.
	... initialize aa ...
	^ aa

I think the "self new" should be "super new", reasoning as follows:

1. It's purely a matter of taste whether the two polygon constructors
are called "new" and "arrowPrototype", or
"psychedelicTrianglePrototype" and "new".
2. A "new" method should not send "self new".
3. Therefore, no constructor should send "self new".  (In particular,
self might belong to a subclass, whose "new" method invokes this very
constructor.)

Is the bug in the code, or my logic?

Rodney



More information about the Squeak-dev mailing list