Automatic index conversion by #at: and #at:put: (was: Re: [squeak-dev]
The Trunk: Collections-ul.427.mcz)
Levente Uzonyi
leves at elte.hu
Thu Feb 24 23:18:50 UTC 2011
On Thu, 24 Feb 2011, Nicolas Cellier wrote:
> Of course, these are hardly whishable features, and I think it is good
> to get rid of #asInteger, but I was intrigued :
>
> (Array new: 100 withAll: 0) asOrderedCollection at: $A put: 1; at:
> '2+10' put: 3; yourself.
> -> try it by yourself before applying the change
>
> (OrderedCollection with: $a with: $b) at: 9/4 put: $c; yourself.
> before change -> #($a $c), after change -> error
>
> Though #($a $b) at: 9/4 still "works"
>
> (OrderedCollection with: $a with: $b) at: 7/4 put: $c; yourself.
> still "works" -> #($c $b)
At least #at: and #at:put: behave the same way.
>
> because Object>>#at:put: still use #asInteger... (only in case of a Number).
> I wonder why we shall let Object interpret our intentions (or bugs)...
> Isn't it time to change it too ?
I guess it is. I wonder what's the idea behind the "magical" conversions.
Levente
>
> Nicolas
>
snip
More information about the Squeak-dev
mailing list
|