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

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 17 03:15:40 PST 2017


On Friday, 17 February 2017 at 04:09:14 UTC, timotheecour wrote:
> * with(module_!"std.foo") is useful for scoping imports to 
> cover several declarations and being DRY; at the expense of 
> adding indentation/nesting and less nice syntax

Doesn't add indentation:

with (module_!"std.stdio, std.traits")
void fun(T)(File input, T value)
if (isIntegral!T);

with/module_ solves the UFCS member stand-in problem elegantly, 
how does your proposal solve it?:

with (module_!"std.range.primitives")
void func(alias pred, R)(R range)
if (isInputRange!R && is(typeof(pred(range.front)) == bool);

.front has to refer to *either* a member or an imported UFCS 
function.


More information about the Digitalmars-d mailing list