Thread overview
[Issue 265] New: Selective import from renamed import behaves strangely
Jul 22, 2006
d-bugmail
Jul 28, 2006
d-bugmail
Dec 24, 2006
d-bugmail
Dec 27, 2006
d-bugmail
July 22, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=265

           Summary: Selective import from renamed import behaves strangely
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: deewiant@gmail.com


import io = std.stdio : foo = writefln;

void main() {
        //writefln("bar");           // doesn't work, good
        //std.stdio.foo("bar");      // doesn't work, good
        //std.stdio.writefln("bar"); // doesn't work, good
        foo("bar");                  // works fine, but a renamed import should
require a FQN according to the spec
        io.writefln("bar");          // works fine, but there shouldn't be a
writefln in io, just a foo
        //io.foo("bar");             // doesn't work: undefined identifier
module stdio.foo
}
--

The inline comments hopefully explain my view of the situation well enough. Essentially: the behaviour of the first three lines in main() is correct and that of the last three is incorrect. Only the last call, io.foo("bar"), should, in my opinion, compile.

Or then the specification needs correcting. Issue 264 and this are both about combining different import methods in ways that apparently haven't been considered, and probably need to be explicitly allowed and shown in examples or disallowed.

In addition, I feel that the last error message is somewhat strange: "module stdio.foo"? As I understand it there should be nothing but a module io, which contains only one function, foo.


-- 

July 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=265


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|RESOLVED                    |REOPENED
           Keywords|accepts-invalid, rejects-   |spec
                   |valid                       |
         Resolution|INVALID                     |




------- Comment #2 from deewiant@gmail.com  2006-07-28 08:38 -------
(In reply to comment #1)

So essentially, the statement "import mymodule = module : myname = name;" is equivalent to the two statements "import mymodule = module; import module : myname = name;". Once again, this is worth noting in the documentation: the way I figured it, the two import methods would combine, as I indicated in the comments.

Reopening with the "spec" keyword and a lower severity.


-- 

December 24, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=265





------- Comment #3 from deewiant@gmail.com  2006-12-24 03:47 -------
Fixed in DMD 0.178, but the code snippet under "Renamed and Selective Imports" in module.html is missing an ending brace, so this shouldn't be resolved yet.


-- 

December 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=265


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from bugzilla@digitalmars.com  2006-12-27 01:58 -------
Fixed DMD 0.178


--