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

SymDict interferes with the Dict constructor #1

Closed
cstjean opened this issue Jun 29, 2016 · 5 comments
Closed

SymDict interferes with the Dict constructor #1

cstjean opened this issue Jun 29, 2016 · 5 comments

Comments

@cstjean
Copy link

cstjean commented Jun 29, 2016

Dict{Symbol, Any}(Dict{Any, Any}(:x=>3))

returns a Dict{Symbol, Any} but

using SymDict
Dict{Symbol, Any}(Dict{Any, Any}(:x=>3))

returns a Dict{Any, Any}

@samoconnor
Copy link
Contributor

Thanks @cstjean

@cstjean
Copy link
Author

cstjean commented Jun 30, 2016

Hey, I'm sorry, I think I was not very clear in describing the problem. The issue is that the constructor on this line shadows the Base constructor for Dict(::Associative). I initially filed an issue on JuliaLang before realizing that the problem from this package. You can reproduce the bug by running the above code in two fresh Julia sessions. Dict{Symbol, Any}(dict) should always return a Dict{Symbol, Any}, but it doesn't when SymDict is imported.

@samoconnor
Copy link
Contributor

Hi @cstjean,

I could indeed reproduce the problem you described.
With the fix I made it works for me now:

$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.2 (2015-12-06 21:47 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-apple-darwin13.4.0

julia> using SymDict


julia> Dict{Symbol, Any}(Dict{Any, Any}(:x=>3))
Dict{Symbol,Any} with 1 entry:
  :x => 3

Would you suggest a different fix?

@cstjean
Copy link
Author

cstjean commented Jun 30, 2016

I can reproduce your result, but if I import IJulia first:

julia> using IJulia

julia> Dict{Symbol, Any}(Dict{Any, Any}(:x=>3))
Dict{Symbol,Any} with 1 entry:
  :x => 3

julia> using SymDict

julia> Dict{Symbol, Any}(Dict{Any, Any}(:x=>3))
Dict{Any,Any} with 1 entry:
  :x => 3

That's really weird.

@cstjean
Copy link
Author

cstjean commented Jun 30, 2016

New issue. Sorry for blaming SymDict!

samoconnor pushed a commit that referenced this issue Nov 6, 2017
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

2 participants