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

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 14 02:23:51 PST 2017


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?



More information about the Digitalmars-d mailing list