So this problem I posted on squeak-dev about BDFFontReader and how it has its own #new class method to create new instances of itself, but in doing so failed to also send an #initialize message to each new instance and thus when it was actually used an instance variable was left as nil when it should not have been.

One recommendation was to simply remove the #new method and thus default to the superclass #new which, if I'm not mistaken, would then result in #new from Behaviour to be invoked and that one does also send #initialize to self.

I think, IIUC, this recommendation only makes sense because BDFFontReader is a direct subclass of Object.

Initially though this recommendation didn't make any sense to me because I didn't know how the implementation of #new in Behaviour is different from strict Smalltalk-80 as I understand it. I.e. originally in Smalltalk-80 #new did not also send #initialize, but now in Squeak it does.

Just for fun I did a search for senders of #basicNew and I found quite a few which are from #new methods in classes which subclass directly from Object and which are in classes that also define their own #initialize method. The curious bit is how some of these #new methods do send #initialize, but not all. I'm guessing some that don't are for abstract classes, but is it true that all are?

Now I read on the WWW that the added sending of #initialize from Behaviour>>new was added in 3.9.

Unfortunately whomever actually did the change failed to document the important differences here, and why! How is it that with such a wonderful system for documenting code we still end up with totally missing documentation? I've now gone on a huge wild goose chase because of this. How many others who have not kept track of how Squeak is evolving away from other Smalltalk-80 implementations will waste similar amounts of time?

I'm guessing that some of the now unnecessary #new methods are simply still not cleaned up since then? If so, why not? They're easy enough to find!

Also, doesn't this still create an _enormous_ portability problem with other Smalltalks?

(BTW, I'm not even sure I buy into any of the other arguments for having default invocation of #initialize, i.e. those beyond the blatant incompatibility with what seems to be _all_ other implementations and _all_ existing documentation about the fundamentals of Smalltalk. I remember naively thinking this would be a good idea way back in the early 80's when I last spent any amount of time fiddling with Smalltalk, and I also seem to remember all the wise gurus around me quietly patting me on the head and telling me that no, such a change would not be welcome, and I should just learn to do things explicitly like they should be done.)

--
                                        Greg A. Woods; Planix, Inc.
                                        <[EMAIL PROTECTED]>

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to