Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No promotion of integertypes for Dict keys #6580

Closed
ehelle opened this issue Apr 19, 2014 · 2 comments
Closed

No promotion of integertypes for Dict keys #6580

ehelle opened this issue Apr 19, 2014 · 2 comments

Comments

@ehelle
Copy link

ehelle commented Apr 19, 2014

Using integers as Dict keys; Int64 numbers doesn't equal Int32 numbers.

julia> mydict = Dict()
Dict{Any,Any}()

julia> a = int32(4)
4

julia> mydict[a] = 45345435
45345435

julia> mydict[4]
ERROR: key not found: 4
in getindex at dict.jl:500

julia> mydict[int64(4)]
ERROR: key not found: 4
in getindex at dict.jl:500

julia> mydict[int32(4)]
45345435

julia> int32(4) == int64(4)
true

@StefanKarpinski
Copy link
Sponsor Member

This is a fairly deep issue, that stems from this:

julia> isequal(int32(4),int64(4))
false

I have a lot of work done towards changing hashing so that it matches == more closely, but it's a tricky problem. Maybe I can find some time this weekend to finish up that work and integrate it with the rest of Julia. It will be a somewhat disruptive change that we can't really add deprecations for.

@JeffBezanson JeffBezanson modified the milestone: 0.3 Apr 19, 2014
@JeffBezanson
Copy link
Sponsor Member

dup of #5314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants