Searching dictionaries for large integer values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Searching dictionaries for large integer values

RT Happe
I note: (i) large integers are mutable objects whose idenity #== may
distinguish equal numbers;  (ii) Dictionary>>keyAtValue:ifAbsent:
compares values by identity, commenting

  "ANSI standard states that #= be used rather than #==, but long
   established standard is the latter".

By synergy, #keyAtValue: will usually fail to find the key for, say,
a large error code; for instance

  Win32ErrorsEx at: 'ERROR_DS_UNWILLING_TO_PERFORM'
  ==> 2147950645
  Win32ErrorsEx keyAtValue: 2147950645
  raises an error

Well, I sympathise with the Ansi standard.

rthappe


Reply | Threaded
Open this post in threaded view
|

Re: Searching dictionaries for large integer values

Christopher J. Demers
"RT Happe" <[hidden email]> wrote in message
news:[hidden email]...
> I note: (i) large integers are mutable objects whose idenity #== may
> distinguish equal numbers;  (ii) Dictionary>>keyAtValue:ifAbsent:
> compares values by identity, commenting
...
> By synergy, #keyAtValue: will usually fail to find the key for, say,
> a large error code; for instance
>
>   Win32ErrorsEx at: 'ERROR_DS_UNWILLING_TO_PERFORM'
>   ==> 2147950645
>   Win32ErrorsEx keyAtValue: 2147950645
>   raises an error

That is something interesting to be aware of.  You may already be aware of
this, but in this situation you will probably want to use
keyAtEqualValue:ifAbsent:  instead of keyAtValue: to avoid the issue you
describe.

Chris