About KCP and automatic initialize

ducasse ducasse at iam.unibe.ch
Mon Sep 15 11:37:47 UTC 2003


>
> would you agree that the _general_ Smalltalk convention in reality
> ( implementations, ANSI ) is that #new is not sending #initialize?

Hi martin,
Do you really believe that?

Ask vendors what they think about ANSI. Ansi is a bad standard that 
check
that classes implement protocols.

With your line of behavior Smalltalk is dead, because nothing new can 
happen.
Nothing. and you know people will start to like better and better Ruby 
and other.

Imagine soon ruby will have a code browser and a nice debugger, (when 
ruby started
it runs on 2 platforms and now it runs everywhere. Looks at Eclipse for 
Java, look
at the hot compilation in Objective-C.

So the ANSI standard is a trap. Someone told me that peter deutsch left 
the room the
afternoon of the first day because I saw that this would not be a 
standard but just a
  battle of vendors to not get imposed stuff.

So


>>> There will be made many mistakes by those who are not accustomed to
>>> this behavior.
>>>
>>>
>> Its just a matter of documenting/learning. New users make mistakes...
>> That's natural.
>> Note however that avoiding this mistake can be enforced by the system.
>> When you
>> redefine #new in Squeak, an notification window appears saying that
>> its "dangerous" and
>> whether this is what do you want. We can extend this comment by
>> telling about the initialisation
>> pattern.... Hence, people can *not* forget it.
>>
>>> Additionally I think it is really easy to forget about it: If one
>>> plans to use #initialize for resetting or preparing later on etc,
>>> rather than for creating, it may not come to ones mind that during
>>> creation it is called too.
>>>
>>>
>> I'd rather suggest "reset" for a method doing resets... It reflects
>> better what a such method does...
>> One should keep "initialize" for initialization...
>>
>> Any way, we can not avoid people doing silly things (bad names, bad
>> desings, ...)...
>
>
> It is even more silly to explicitly call a super method and not to
> check on what it does, and yet as you found out, it happened 2 or 3
> times even in the standard image. Now have a look how often
> #initialize is send not during creation times and you will see that
> the semantics of #initialize in reality is not what your idea is
> implying: that it is only for creation. Practically speaking, it is
> not silly to think #initialize is part of and ONLY part of creation.


Noury did not implied that. I'm sorry but this discussion make no sense.


>
> To pop up warning-messages to prohibit the programmer from making some
> special mistakes out of a myriad of possible mistakes does not help.
> I guess this new-warning-dialog is more confusing than helpful for a
> beginner.
>
> An initialize-warning-dialog would be unhelpful too for beginners,
> annoying for others and hmm.. an indication for a wrong design
> decision? ( why do we have to pop up warnings for every method we want
> to write? is this a bad programming language? ).
>
> Furthermore you can turn your argumentation around: If you believe in
> warnings, it may be a better idea to remind the programmer with the
> new-warning-message not to double-send #initialize.
>
> Regards
> Martin
>
>
>



More information about the Squeak-dev mailing list