Dictionaries broken in 3.9a

stéphane ducasse ducasse at iam.unibe.ch
Sun Sep 18 08:21:40 UTC 2005


I checked in VW nil is not a valid key for a dictionary

|d|
d := Dictionary new.
d at: nil put: #none.

Boum

at: key put: anObject
     "Set the value at key to be anObject.  If key is not found,  
create a new
     entry for key and set is value to anObject. Answer anObject."

     | index element |
     key == nil ifTrue: [^self subscriptBoundsErrorFor: #at:put:  
index: nil value: anObject].
     index := self findKeyOrNil: key.
     element := self basicAt: index.
     element == nil
         ifTrue: [self atNewIndex: index put: (self createKey: key  
value: anObject)]
         ifFalse: [element value: anObject].
     ^anObject


Stef




On 18 sept. 05, at 09:33, stéphane ducasse wrote:

> Strange since we did not even introduce the changes of andrew on  
> associations....
> I will look at that.
>
> Stef
>
> 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.
>>
>> 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