Import modules too verbose in some cases

Johnson Jones via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 9 16:57:19 PDT 2017


Sometimes one doesn't want to import either the whole module nor 
specify a single function to import. It seems that basically D 
has all the info to import the function implicitly because it 
usually gives a nice error message tells us which module to 
import for the function.

e.g.,

A.B.C()

"Did you forget to import module A.B?"

and so we have to do

import A.B;
A.B.C();

Sometimes we still need to specify the fully qualified name due 
to conflicts with other modules.


Rather, how about a new feature were we do not have to import 
modules at all by specifying the fully qualified name? Since 
conflicts might occur, how bout using a symbol to express that?

#A.B.C();

or

@A.B.C();

or

$A.B.C();

same as

import A.B;
A.B.C();


So, for one offs we don't have to write the import statement.





More information about the Digitalmars-d mailing list