www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12398] New: Selective imports no longer act as static imports

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

           Summary: Selective imports no longer act as static imports
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-18
13:15:43 EET ---
////////// test.d /////////
import std.stream : Stream;

void main()
{
    std.stream.File f;
}
///////////////////////////

I don't see any purpose for this breakage.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-18
04:22:45 PDT ---
(In reply to comment #0)
 ////////// test.d /////////
 import std.stream : Stream;
 
 void main()
 {
     std.stream.File f;
 }
 ///////////////////////////
 
 I don't see any purpose for this breakage.

According to this[1] comment the above should work. [1] https://d.puremagic.com/issues/show_bug.cgi?id=12359#c0 Comment: ----- import std.ascii : isDigit; // Don't create alias silently bool isDigit(char c) { return true; } alias isDigit = std.ascii.isDigit; // explicitly merge overloads void main() { dchar d = 'a'; isDigit(d); // matches to std.ascii.isDiigt } ----- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #2 from bearophile_hugs eml.cc 2014-03-18 05:16:58 PDT ---
(In reply to comment #0)
 ////////// test.d /////////
 import std.stream : Stream;
 
 void main()
 {
     std.stream.File f;
 }
 ///////////////////////////
 
 I don't see any purpose for this breakage.

Here you have asked to import just the name "Stream", so the "std.stream" name is missing. This is how things should be in a serious implementation of a module system. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2014-03-18 06:50:24 PDT ---
(In reply to comment #0)
 ////////// test.d /////////
 import std.stream : Stream;
 
 void main()
 {
     std.stream.File f;
 }
 ///////////////////////////
 
 I don't see any purpose for this breakage.

What's changed? With 2.065: test.d(5): Error: undefined identifier std.stream.File With git-head: test.d(5): Error: undefined identifier 'File' test.d(5): Error: std.stream.File is used as a type Excepting the minor diagnostic change, the failing compilation is the expected result. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-18
07:46:02 PDT ---
I think Vlad's test-case was probably from his AE lib. The issue is likely that
'std.stream' was publicly available from within some other module, for example
this works in 2.065:

-----
import std.stdio;  // comment this out for failure
import std.stream : Stream;

void main()
{
    new std.stream.File(__FILE__);
}
-----

This no longer works in git-head, but I think that's ok.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2014-03-18 07:55:58 PDT ---
(In reply to comment #4)
 I think Vlad's test-case was probably from his AE lib. The issue is likely that
 'std.stream' was publicly available from within some other module, for example
 this works in 2.065:
 
 -----
 import std.stdio;  // comment this out for failure
 import std.stream : Stream;
 
 void main()
 {
     new std.stream.File(__FILE__);
 }
 -----
 
 This no longer works in git-head, but I think that's ok.

Yes, it is exactly the issue 313, it should be rejected in git-head. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #6 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-19
01:07:43 EET ---
Oh, I see. Thanks.

Invalid? Or enhancement? I think selective imports ought to also act as static
imports.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-19
01:11:01 PDT ---
(In reply to comment #6)
 Oh, I see. Thanks.
 
 Invalid? Or enhancement? I think selective imports ought to also act as static
 imports.

For that I suggest: ----- static import std.stream : Stream; void main() { std.stream.File f; } ----- This is currently disallowed: Error: static import stream cannot have an import bind list So it wouldn't be a breaking change to add support. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398



--- Comment #8 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-19
10:12:51 EET ---
(In reply to comment #7)
 static import std.stream : Stream;

Honestly if I saw that, I'd think it only allowed referring only to Stream and only by its fully-qualified name. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12398


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 24 2014