Le 15/10/2012 15:02, Peter Alexander a écrit :
On Monday, 15 October 2012 at 12:43:59 UTC, Manu wrote:
Surely this has been considered before. Any reasons it's not supported?
Yes, it has been considered before. There is an enhancement from ages
ago in bugzilla.
http://d.puremagic.com/issues/show_bug.cgi?id=3603
The syntax you proposed doesn't work, because it conflicts with
selective imports:
===[std.d]===
module std;
void stdio() {}
===[test.d]===
import std : stdio;
Does that import the stdio function from module std, or the module
std.stdio?
You could use something like this:
import std.(stdio, xml, algorithm);
Of course, there's many variations (square brackets, curly braces, no
dot, no commas...) but it's all bikeshedding.
I don't think import should make the difference between packages/modules
and module content.
The example you take is only ambiguous if std is both a package and a
module which isn't allowed anyway now. It is a point on which people are
willing to advance already (Andrei have made a proposal about it).
I'm against introducing more new syntax to import. import is already a
complex beast.