[Issue 15248] Function in current module is not allowed to overload imported function

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Oct 26 03:39:54 PDT 2015


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

Maxim Fomin <mxfomin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mxfomin at gmail.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|enhancement                 |normal

--- Comment #1 from Maxim Fomin <mxfomin at gmail.com> ---
The hijack.html is rather rationale than formal spec (and thus can be
interpreted in different ways), but in the beginning it contains:

The first stab at fixing this problem in the D programming language was to add
the rules:

    1. by default functions can only overload against other functions in the
same module
    2. if a name is found in more than one scope, in order to use it it must be
fully qualified

I think round() is found in several scopes and thus must be fully qualifyed.

AFAIK approx. a year ago semantic of overloading what changed but I cannot find
any mention in the spec or in the changelog (one of the features is ability to
hijack round() by placing import inside function). Also I remember some issues
were filed with complains about new behavior but they were closed as invalid -
even seasoned D users were unaware of new behavior. Definetely there is a spec
problem.

--


More information about the Digitalmars-d-bugs mailing list