syntax sugar: std.path::buildPath instead of from!"std.path".buildPath
Daniel Kozak via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 14 02:44:14 PST 2017
Dne 14.2.2017 v 11:21 Johannes Pfau via Digitalmars-d napsal(a):
> 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
Exactly! I was going to write the same
More information about the Digitalmars-d
mailing list