proposal: improved import declaration

C. Dunn cdunn2001 at gmail.com
Mon Jul 30 19:01:39 PDT 2007


David B. Held Wrote:

> eao197 wrote:
> > [...]
> > import tango.io.{Console, Conduit, FilePath, FileSystem, Stdout};
> 
> I like Java's syntax better:
> 
> import tango.io.*;

I am glad that this is not supported.  I do not like the basic import statement at all.  I would like it restricted to static, renamed, and selective imports.  The reader of a file should not have to guess where any given symbol came from.

But I agree with the original poster that there should be something like Python's:
  from tango.io import a,b,c,...;

If you need to import dozens of modules from the same package, you can create a single module which does all the imports publicly.
  module alltango;
  public import tango.io.A;
  public import tango.io.B;
  public import tango.io.C;  
  // ...

Then:
  import alltango;
gives you everthing.  But I still prefer static imports.



More information about the Digitalmars-d mailing list