February 10, 2003 Re: D should provide file paths for import | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kublai Kahn | Kublai Kahn wrote:
> In Java it restricts you to one import per line.
> Such as:
>
> import Java.awt.Graphics;
> import Java.applet.Applet;
>
> It won't let you import multiple includes on one line.
> import Java.awt.Graphics, Java.applet.Applet;
>
> Could D allow you to import more than one library per line?
> Is this a good idea? Please comment...
I expect D could very easily add such an extension (with
probably no more than a dozen lines of extra code), however
this is no more than simple syntax sugar to save typing a
few characters (in this case 5). My other misgiving about
this idea is that the comma and full stop characters are
difficult to differentiate in many proportional fonts (not
every one programmes using text mode, many people use an
IDE which may make spotting the difference between the lines
import d.mod,other;
import d.mod.other;
very difficult, which could lead to the intent of programmes
being missinterpreted (syntax errors may also be a problem,
changing the semantics of the line if a comma is used in
place of a full stop, however I expect the compiler should
be able to detect such typographical errors - in some cases
checking for this error may prove difficult, or may result
in wierd errors at the link stage).
In summary, I see little benifit for adding such a convention
and several pitfalls, my recommendation would be for D to
only import one module per statement.
C 2003/2/10
|
Copyright © 1999-2021 by the D Language Foundation