https://issues.dlang.org/show_bug.cgi?id=15114

RazvanN <razvan.nitu1...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1...@gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1...@gmail.com> ---
All the behavior exhibited here is according to the spec.

v1: The global import introduces the namespace of std.math, however, module
symbols have precedence over that. Unfortunately, the dot (.) notation does not
help you here since it simply instructs the compiler to search for the symbol
at module scope. So it does and it finds the user defined sin and concludes
that you are having a forward reference problem and cannot deduce the type.
Expected behvior.

v2: By using the FQN you instruct the compiler to look in std.math and that
solves the issue.

v3: Selective imports are translated behind the scenes to an alias declaration,
i.e. alias sin = std.math.sin. This introduces the std.math.sin in the overload
set of the the sin in the current module. However, the fully qualified name is
not introduced in the namespace.

v4: std.math.sin and sin are now in the same overload set so naturally you get
a conflict.

v5: same as v4. The fact that there is an extra `import std.math` simply
instructs the compiler that the `std.math` symbol is visibile, but std.math.sin
and sin are still in the same overload set.

This all is expected behavior and changing any of the above behavior will most
likely cause lots of breakages.

I'm closing this as INVALID.

--

Reply via email to