www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 264] New: No selective static imports

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=264

           Summary: No selective static imports
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


I'm not sure if this should be allowed, but it seems to me that the
specification doesn't disallow it:

--
static import std.stdio : writefln;

void main() {
        std.stdio.writefln("bar");
}
--

Currently this doesn't compile, as the import works the same way as it would
without the "static". This is, in a way, understandable, as normal selective
imports leave the imported module's name undefined. I nevertheless feel that
this is a small loss in functionality.

Allowing this might introduce a new issue, however. Consider the following:

--
static import std.stdio : foo = writefln;

void main() {
        std.stdio.foo("bar");
}
--

The above might make it seem as though there is something called foo in the
std.stdio package.


-- 
Jul 22 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=264


bugzilla digitalmars.com changed:

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




------- Comment #3 from bugzilla digitalmars.com  2006-08-11 19:15 -------
Fixed DMD 0.164 (made static import with bind list illegal)


-- 
Aug 11 2006