Dictionaries broken in 3.9a
stéphane ducasse
ducasse at iam.unibe.ch
Sun Sep 18 08:30:10 UTC 2005
On 18 sept. 05, at 08:48, Andreas Raab wrote:
> Hi -
>
> Trying out some stuff, I noticed that
>
> dd := Dictionary new.
> dd at: nil put: #none.
>
> will raise an error in 3.9a saying that "Dictionaries cannot
> meaningfully key by nil". That makes no sense. Dictionaries can
> perfectly contain nil keys, they always have and they always will.
Andreas why are you saying that with that kind of implication. Now
you can get mad about changes, this is perfectly comprehensible
but try to be nicer, your kind of anger does not help us.
I do not know why the behavior changed. I'm adding a test to cover
this exact semantics point.
Now as I say in my previous email nil is not allowed in Visualworks,
I do not have dolphin at hand.
I checked the ansi standard for what it is good at:
p, 168
5.7.2.5 Message: at: key put: newElement
Synopsis
Store newElement at key in the receiver. Answer newElement.
Definition: <abstractDictionary>
If lookup succeeds for key, then newElement replaces the element
previously stored at key.
Otherwise, the newElement is stored at the new key. In either
case, subsequent successful
lookups for key will answer newElement. Answer newElement.
The result is undefined if the key is nil.
This clearly indicates that different smalltalks where doing
different assumptions.
Now if this was possible in 3.8 I think that this is better to keep
it like that.
You see I can even be constructiv and positive.
So now let us find the guilty cs.
Stef
>
> Could somebody please explain to me why we no longer allow a
> perfectly good key in dictionaries?
>
> Cheers,
> - Andreas
>
>
More information about the Squeak-dev
mailing list
|