The problem is that both Gtk and Gadfly exports a draw function. Internally 
those are scoped by module so that their name is Gadfly.draw() and 
Gtk.draw(), and you can call them as such in your code. We can't merge the 
function's method, because there is no way to know which one to call if 
both define a draw(a::Any) method.

When you use `using` you import the exported identifiers into the local 
scope, and if there is a conflict you run into trouble because you don't 
know which one you'll get.

There is an issue to change the behaviour to give a warning when using an 
ambiguous identifier in #4345 
<https://github.com/JuliaLang/julia/issues/4345>. 

Ivar

kl. 11:59:39 UTC+2 tirsdag 22. juli 2014 skrev Andreas Lobinger følgende:
>
> Hello colleagues,
>
> i was for some time under the impression, that the exact sequence of 
> imports do not matter (let's say, i hoped) as the definitions of types and 
> functions are cumulative, modules should be self contained and use require 
> where needed.
>
> Today:
>
> lobi@maroon:~/juliarepo$ ../julia/julia 
>                _
>    _       _ _(_)_     |  A fresh approach to technical computing
>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>    _ _   _| |_  __ _   |  Type "help()" to list help topics
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.3.0-rc1+116 (2014-07-21 15:59 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Commit e75595f* (0 days old master)
> |__/                   |  i686-linux-gnu
>
> julia> using Gadfly
> Warning: could not import Base.has into Gadfly
> Warning: could not import StatsBase.bandwidth into Stat
> Warning: could not import StatsBase.kde into Stat
>
> julia> using Gtk
>
> julia> methods(draw)
> # 3 methods for generic function "draw":
> draw(redraw::Function,widget::GtkCanvas) at 
> /home/lobi/.julia/v0.3/Gtk/src/cairo.jl:56
> draw(widget::GtkCanvas) at /home/lobi/.julia/v0.3/Gtk/src/cairo.jl:61
> draw(widget::GtkCanvas,immediate::Bool) at 
> /home/lobi/.julia/v0.3/Gtk/src/cairo.jl:61
>
> julia> 
>
> In contrast to:
>
> lobi@maroon:~/juliarepo$ ../julia/julia 
>                _
>    _       _ _(_)_     |  A fresh approach to technical computing
>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>    _ _   _| |_  __ _   |  Type "help()" to list help topics
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.3.0-rc1+116 (2014-07-21 15:59 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Commit e75595f* (0 days old master)
> |__/                   |  i686-linux-gnu
>
> julia> using Gtk
>
> julia> using Gadfly
> Warning: could not import Base.has into Gadfly
> Warning: could not import StatsBase.bandwidth into Stat
> Warning: could not import StatsBase.kde into Stat
>
> julia> methods(draw)
> # 30 methods for generic function "draw":
> draw{P}(backend::Backend,t::Transform,units::UnitBox{S,T,U,V},box::AbsoluteBoundingBox,form::Form{P})
>  
> at /home/lobi/.julia/v0.3/Compose/src/form.jl:23
> draw(backend::Backend,root_canvas::Context) at 
> /home/lobi/.julia/v0.3/Compose/src/container.jl:271
> draw(img::Image{B<:ImageBackend},form::Form{P<:FormPrimitive}) at 
> /home/lobi/.julia/v0.3/Compose/src/cairo_backends.jl:680
>
>
> ?
>
> Wishing a happy day,
>         Andreas
>
>
>

Reply via email to