[question]types

Daniel daniel.a.joyce at worldnet.att.net
Tue Jun 20 21:08:03 UTC 2000


> Thanks for all answers. I'm was aware of some of the thing you told me.
> My preferences in this context is that I as a user would like the computer
> to be smarter and take what I give it and use it to do something in the direction
> I was thinking. Nothing more. :-)
> 
> Karl

	But the computer CAN'T know what you mean, unless you explicitly tell
it....

	And 
	
	|a|
	a ifTrue:[ do foo ] ifFalse: [ doBar ]

	if you forget to set a to true, and it defaults to false, then you may
be wondering "Why is true never executed." Then you get the wonderful C
style hunt for unintialized vars. Except unlike C, which crashes and
burns on NULLS, this version of SmallTalk would merrily do wrong things
until you found the particular method ( out of thousands ) with the
particular var ( in this case a, one of several ) which was not
initialized properly ( in this case to true ). Ugh!

	Now if a is by defualt nil, the SmallTalk will cheerfully point out
your cluelessness to you. Pretty easy.

	Until computers can code for themselves ( and put us out of our jobs ),
they can't make assumptions about state. They don't know what we want.
So I favor explicitness! STATE IT.

	Lord knows how many default initialization bugs I had to chase down in
BASIC, which usually initilizes to defaults. Man! If it had barfed, I
would have caught my logic error from the get go, instead of trying to
find that one var that BASIC decided was best to silently init to a
default, and not tell me!

	Also, we would need a default polymorphic nil for EVERY class in the
system to make this work.
	What is a 'nil morph' as opposed to a 'nil integer' or a 'nil array'?

	Daniel





More information about the Squeak-dev mailing list