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

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


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



More information about the Digitalmars-d mailing list