syntax sugar: std.path::buildPath instead of from!"std.path".buildPath

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 14 03:05:19 PST 2017


Am Tue, 14 Feb 2017 10:23:51 +0000
schrieb Daniel N <no at public.email>:

> On Tuesday, 14 February 2017 at 10:21:03 UTC, Johannes Pfau wrote:
> > Am Mon, 13 Feb 2017 19:49:28 -0800
> > schrieb Timothee Cour via Digitalmars-d 
> > <digitalmars-d at puremagic.com>:
> >  
> >> What about allowing syntax sugar as an alternative to relying 
> >> on the new `from/Module` inline import idiom:
> >> 
> >> ```
> >> void fun(T)(std.stdio::File input, T value) if
> >> (std.traits::isIntegral!T) {...}
> >> ```  
> >
> > If you use a single ':' instead you can argue it's simply a 
> > shortened, inline version of a selective import:
> >
> > import std.stdio : File;
> > //still valid D
> > import std.stdio:File;
> > //expression instead of statement => remove ;
> > import std.stdio:File
> > //We're not importing a symbol, we're simply referring to it
> > std.stdio:File
> >
> > -- Johannes  
> 
> my_module:File
> 
> is it a label followed by File or File inside my_module?
> 

This might be a problem. Labels can only occur in front of a
statement though:
https://dlang.org/spec/statement.html#LabeledStatement

So it boils down to:
ModuleFullyQualifiedName:ImportBind vs LabeledStatement


-- Johannes



More information about the Digitalmars-d mailing list