[question]types

Karl Ramberg karl.ramberg at chello.se
Tue Jun 20 15:24:09 UTC 2000


Hi,
	I've been wondering why variables don't default to something meaningful
	in their context, when they are not initialized. Smalltalk is a untyped
	language but it still requires types when the variables are uninitiated. 
	If for example the variable recognizes it's context it could default
	to something like: 

	a == nil == false == 0 == '' == empty collection or bag or what ever.

	Then one could use these examples without telling the number value or
	Boolean .
	
	a + 2  => 2 	"a defaults to 0"

	a
	 ifTrue:[]		"a defaults to false"

	It is probably several reasons to not make the system like this, but
	from a beginners perspective it makes sense. 


Karl





More information about the Squeak-dev mailing list