I'm trying to understand if this is a feature or a bug.  After "using A", 
if I immediately define "f(x::Float64)" then it silently masks the exported 
method A.f(x).  However if I call f(0) before trying to redefine it, then I 
get a nice error.  I feel like either:

   1. The error is incorrect and f(x::Float64) should mask A.f(x)
   2. Implicitly masking A.f(x) with f(x::Float64) should *always* produce 
   an error

If #1 is true and it's correct to mask A's definition, then it would be 
nice to have a warning like: "WARN: A.f is now masked by Main.f.  Call A.f 
explicitly to access it."

Thoughts?


               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+4311 (2015-04-17 03:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 58cef56 (15 days old master)
|__/                   |  x86_64-redhat-linux

julia> module A
       export f
       f(x) = 999
       end

julia> using A

julia> f(0)
999

julia> f(x::Float64) = 0
ERROR: error in method definition: function A.f must be explicitly imported 
to be extended


               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+4311 (2015-04-17 03:14 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 58cef56 (15 days old master)
|__/                   |  x86_64-redhat-linux

julia> module A
       export f
       f(x) = 999
       end

julia> using A

julia> f(x::Float64) = 0
f (generic function with 1 method)



Reply via email to