About {} and its limits
stéphane ducasse
ducasse at iam.unibe.ch
Thu Feb 10 14:03:03 UTC 2005
hi all
we (the guys from berne and roel) spent a great morning discussing
about the problem of self-evaluating representation. This is a bit too
long to send the result of the discussion sicne this is related to the
difference between meta and base programming.
But we came up with a satisfactory fix for Array:
Display the most that we can when we have the information.
Please have a look and let us know, because we think that this is a
good fix, cheap and
(if you remember I was against {} but with this fix in fact I changed
my mind after the discussions and I
prefer them compared to #(). But {} printing should be fixed with these
changes. )
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'
Stef
More information about the Squeak-dev
mailing list
|