Why we should remove {} from Squeak
ducasse stephane
ducasse at iam.unibe.ch
Mon Oct 1 06:33:56 UTC 2001
>
> I agree that {...} is useful.
>
> {e1. ... . en} is equivalent to
> (OrderedCollection new "note no semicolon"
> add: (e1);
> ...
> add: (en);
> asArray)
> so it obviously CAN be eliminated. That doesn't mean it should be.
> #@ can be eliminated too: aNumber @ anotherNumber is equivalent to
> Point x: aNumber y: anotherNumber. That doesn't mean #@ should be
> eliminated.
There is a big different @ is a message not a parsed construct with specific
rules!!!!!
> The practical questions are
> - would eliminating this feature save more code in the parser and elsewhere
> than it would cost in all the code using it (remember, not all such code
> is known to SqC or anyone else)
I could remove it!
> - is ideological purity worth the loss of clarity?
Sure else Smalltalk would be like Java
> - would it be feasible to make {} support a module?
>
> At 8:49 +0200 9/30/01, ducasse stephane wrote:
>> #() is necessary because it is compiled statically and cannot not be
>> simulated by other construct. Storing #() in Stack frame is not really goo
>> but this is an implementation aspect.
>
> This is false. Any use of # can be eliminated by adding a class variable
> and a class method using lazy initialisation. For example,
> #( abc 'abc' 4 3.4 $r )
This is not my point. I was just saying that storing #() in stake frame can
lead to strange error.
> can be written as
> MyClass literal27
> where
> MyClass class>>literal27
> literal27 ifNil: [
> literal27 := (OrderedCollection new
> add: 'abc' asSymbol;
> add: 'abc';
> add: 4;
> add: 3.4;
> add: $r;
> asArray)].
> ^literal27
>
> Come to think of it, we could eliminate $r and 'abc' too:
> 'abc' is (String fromPacked: 6382179) allButFirst
> $r is Character value: 114.
I'm really sorry to see the level of the discussion
I will never read your email anymore!!!
Bye
More information about the Squeak-dev
mailing list
|