[BUG,FIX]True(Object)>>error:

stéphane ducasse ducasse at iam.unibe.ch
Fri Feb 25 18:43:17 UTC 2005


Sigh.  It's so frustrating to have defined something utterly simple and 
consistent, and then have the ANSI committee make it more complicated, 
and then have people wanting to do good by being consistent with the 
standard, and end up with a system that is not the simplest thing 
possible.
>
> Sorry.   I have to vent every once in a while.
>
> I'm committed to the will of the people, but I have to say...  I told 
> you so.
>
> 	- D

yes this is good that you say that for the young seeds like us. Because 
this is not obvious something to find our way.
By the way have you look at the enh we did to have a better integration 
of {} in smalltalk
Here are some old tests but they convey the overall intention. What we 
did is quite simple and I suggest to be added in squeak (even if now I 
would even be in favor to remove #( ) notation and letting the compiler 
optimise { } when possible)
Stef


testArray
	"self debug: #testArray"

	self assertCode: '#(1 2 3)' print: '#(1 2 3)'.
	self assertCode: '{1 . 2 . 3}' print: '#(1 2 3)'.
	self assertCode: '{1 + 0 . 2 . 3}' print: '#(1 2 3)'.
	self assertCode: '{1 + 0 . 1 @ 2 . 3}' print: '{1 . 1 at 2 . 3}'.
	self assertCode: '{2 at 3}' print: '{2 at 3}'.
	self assertCode: '{Object new}' print: 'anArray #(an Object)'.
	self assertCode: '{Rectangle new . Object new}' print: 'anArray #(nil 
corner: nil,  an Object)'.
	self assertCode: '{10 at 10 corner: 20 at 20 . 100 at 100 corner: 200 at 200}' 
print: '{10 at 10 corner: 20 at 20 . 100 at 100 corner: 200 at 200}'


testObjects
	"self debug: #testObjects"

	self assert: 10 isSelfEvaluating.
	self assert: $a isSelfEvaluating.
	self assert: 3.14157 isSelfEvaluating.
	self assert: #(1 2 3) isSelfEvaluating.
	self assert: #abc isSelfEvaluating.
	self assert: 'abc' isSelfEvaluating.

	self assert: Object isSelfEvaluating.
	self assert: Object new isSelfEvaluating not.

	self assert: (Array with: 10) isSelfEvaluating.
	self assert: (Array with: Object new) isSelfEvaluating not


The code is available at:

  MCHttpRepository
     location: 'http://kilana.unibe.ch:8888/SelfEvaluatingObject'
     user: 'sd'
     password: 'snoopy'





More information about the Squeak-dev mailing list