About KCP and automatic initialize

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Sep 17 00:56:10 UTC 2003


ducasse <ducasse at iam.unibe.ch> wrote:
	> What we don't have is agreement about whether
	>  - the #new-calls-#initialize proposal *IS* better and
	>  - whether it makes sense to have a "better" schema for something
	>    which should very seldom be used at all.
	
	If 42% is seldom I do not know what to tell you.
	
How about reading what I wrote?

I didn't say that #initialize *IS* used seldom,
but that it *SHOULD* be used seldom.  I have by now presented
a lot of evidence in support of that claim.  I am "sad" that
this is being ignored.

What's more, the 42% is bogus.  Why is it bogus?  Because the vast
bulk of that 42% comes from Morph and its descendants.  And since
Morph _already_ has code to automatically invoke #initialize (which
is fair enough, because a #new-born Morph _is_ usable right away),
Morph and its descendants are completely irrelevant to the question.

	> Is there anyone out there who understands my utter FRUSTRATION
	> at the way I can never move forward in my Smalltalk practice because
	> someone keeps yanking out the rug so that I can never use this tool?
	
	But new/initialize will not prevent you to do that.

I make no assertion about *what* stopped RB loading in 3.5.
My assertion is that *something* did, and that there is a common
practice of breaking things in Squeak.  It may well be that this
change won't break RB any worse.  Fine.  The point is that it will
break *other* things and I don't know (and unless you have actually
done all the relevant testing, you don't know either) *what* it will
break.

	At ESUG we loaded RB in 3.6 alpha and it worked.
	
Yes, but the #new-calls-#initialize change is a new change, isn't it?
www.squeak.org's download page describes 3.5 as "the last released
version".  The latest version from Ian Piumarta's site (which I have
just downloaded, but not yet installed) is 3.6g-2.  If some
(unspecified) version of RB worked in 3.6alpha, the sad thing is that
I don't have any reason to expect it to work in 3.6g-2, and I *certainly*
don't have any reason to expect it to work in 3.7<whatever it will be
after the change to Object>>new is made>.

For the record, I have tried loading the RB from Bob'sSuperSwiki and from
SqueakMap, and I have never yet succeeded in *loading* the RB in any
version of Squeak I've tried, let alone running it.  In fact I've made
repeated attempts to get it going this week, but my ability to understand
the problems is very limited, and my ability to fix them nonexistent.

	> Experts can cope with the present system and
	> with the proposed change.  I'm no expert, and I can.
	
	No you are an expert. Do not play this game. If everybody in this 
	community which is really excellent
	would be at your level we would be an excellent level, but we would be 
	a really private club, were newcomer
	has to pass all kinds of dirty tricks.
	
If I'm an expert, how come I can't get the RB going?
If I'm an expert, how come I still dread trying to do anything with Morphic?
If I'm an expert, how come I'm staring at the installation instructions
for Squeak-3.6g-2 and feeling confused?

Here's how I proposed to deal with the #new-calls-#initialize change.
Go through all my code and make sure I *never* implement or send #initialize.
There.  That was easy.  Time-consuming, but easy.  Because it's my code.
With other people's code, not so easy.
	

Let me make one thing plain.  If the proposed change were to make
#new call #initializeYourself (a method which is NOT used anywhere
in the system and is reasonably unlikely to have been used outside
either, given the prevalence of #initialize), and to advise people
to plug into #initializeYourself instead of #initialize,  I would
have no serious quarrel with the proposal.  I'd still murmur that
it's a pity to go out of your way to support poor practice, but I
would not be angry about the cavalier attitude to breaking other
people's code, because it almost certainly _wouldn't_ break other
people's code.

Would making #new send #initializeYourself instead of #initialize
satisfy your goals?

	Our responsibility is to pay attention to the entry level
	without compromising our SOUL.
	
And that's one of the things i keep on point out:  entry level people
DON'T need to be helped to make the mistakes they make anyway, they
need to be helped to do BETTER.  If you are going to talk about
"compromising our SOUL", I have to say that encouraging people to
mindlessly use #new and #initialize stains the soul.

	> I cannot see a change that makes it easier to do the wrong thing (or
	> rather, something which is occasionally sensible but almost always 
	> wrong)
	> as "better" in any honest sense of the word.
	
	I do not know what I tell more.
	
I feel the same frustration.  To me it seems so obvious:

* the change affects one of the most basic messages in Smalltalk
* it is visible to every subclass of Object
* in fact, the *point* of it is to change the way people initialize their code
* it is proposed precisely to support an existing practice which I have
  shown to lead to bad design in *every* example I looked at.

	Note that I like your examples and discussions but reread my emails and 
	the emails of andreas.

I have read them, and I find that they keep on making the same misleading
claims and keep on ignoring my points.  I *know* why you want to do this.
I have admitted to doing the same in some of my own code (BUT to having
taken care NOT to use the name #initialize).

	The point is just that no more and this is a small change.
	
*You* don't type many characters to make the change, true.
In that sense, and that sense *only*, it is a small change.
But it is a change with a large effect; many other people will have
to change their code; the total amount of code that needs changing
may well be very large.

If some other method name were chosen instead of #initialize, the
amount of other people's code that needed changing to compensate for
your change might be small to nonexistent.	
	
Suppose I have this class:

    Object subclass: #Foo
      instanceVariableNames: 'prices'

    Foo class>>new
      ^super new setUp initialize

    Foo>>
      setUp
	"Set a Foo up for the first time ever."
	prices := Dictionary new.
      initialize
	"Initialize a Foo to the usual price list;
	 also used to reinitialize an existing Foo."
	prices at: #petrol put: 1.09 "dollars per litre".
	prices at: #bread  put: 1.49 "dollars per loaf".
	prices at: #house  put: 122000 "dollars per typical Dunedin house".

with other methods suppressed.
Now someone changes the meaning of Object new, and suddenly, without me
changing a line of code, working code turns into crashing code.
Foo new 
==> Error: only integers should be used as indices
which I must say is _not_ the error message I was expecting.

How much code like that is there?  In the system, probably none.
We know at least _one_ such class exists, because I've just written it.
Using #initialize for reinitialisation is rather tempting, so I expect
there's more.  How much more?  Well, the onus of ensuring that there isn't
very much is on the person who wants to break it.

Didn't we have a thread, in fact, haven't we had a recurring thread
over the years, about Object accreting too many features?



More information about the Squeak-dev mailing list