[Issue 12359] implicit overload merging with selective/renamed imports should be removed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 14 06:55:42 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12359



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2014-03-14 06:55:24 PDT ---
(In reply to comment #2)
> (In reply to comment #0)
> > To reproduce same behavior, explicit alias should work.
> > 
> >   import std.ascii : isDigit;   // Don't create alias silently
> > 
> >   bool isDigit(char c) { return true; }
> >   alias isDigit = std.ascii.isDigit;  // explicitly merge overloads
> 
> I don't see how this can work, "std.ascii" should not be visible in the last
> statement.

I think selective imports should make the fully qualified module name still
visible. It's consistent behavior with basic imports.

====

For the future enhancement, I'm planning to add variations of import
declarations. Just the ideas:

1. static selective import

  static import std.stdio : writeln;
  //writeln();  // NG
  std.stdio.writeln();  // OK
  //std.stdio.writefln("");  // NG

2. static renamed import

  static import io = std.stdio;
  //writeln();  // NG
  //std.stdio.writeln();  // NG
  io.writeln();  // OK

3. static selective renamed import

  static import io = std.stdio : writeln;
  io.writeln();  // OK
  //io.writefln("");  // NG

4. unnamed import

  import = std.stdio;
  writeln();  // OK
  writefln("");  // OK
  //std.stdio.writeln();  // NG

5. unnamed selective import

  import = std.stdio : writeln;
  writeln();  // OK
  //writefln("");  // NG
  //std.stdio.writeln();  // NG

They are much flexible than the current behavior. Increasing orthogonality will
give to programmers the ability to control imported names more precisely.

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


More information about the Digitalmars-d-bugs mailing list