Why we should remove {} from Squeak

Dirk Wessels icircle at xs4all.nl
Tue Oct 2 09:25:22 UTC 2001


----- Original Message -----
> Nothing stops the compiler recognising
>
> {e1. ... en} asOrderedCollection
>
> as a special case, or for that matter
>
> {e1. ... en} asSet
>

I thought that it might be interesting to have a "pre-evaluate"-option in
smalltalk.

method1
| arrayConstant classListConstant byteArray pi |
Smalltalk preEvaluate: [
  arrayConstant := {1 3 4 5 6} asIntegerArray. "converted only once!"
  classListConstant := {OrderedCollection Collection SortedCollection Array}
asArray.
  byteArray:= {3 4 3 5 34 43 3 4} asByteArray.
  pi:= (1.0 asin) *2.0.  "calculated only once!"
].
"the rest of the code"
^pi.








More information about the Squeak-dev mailing list