D import idiom compilation time
Martin Tschierschke
mt at smartdolphin.de
Tue Jan 8 10:54:24 UTC 2019
On Monday, 7 January 2019 at 21:50:20 UTC, Andrei Alexandrescu
wrote:
> On 1/5/19 5:48 PM, Dgame wrote:
[..]
> So I suggest the glorious hack:
>
> alias std = from.std;
>
> so then things like std.traits.isIntegral and
> std.algorithm.comparison.min resolve and auto-load properly,
> while also standing beautifully in the documentation.
>
>
> Andrei
I just started playing around with it, it might be no surprise,
but if you go further and start to make some local aliases inside
main() like
alias writeln = std.stdio.writeln; // for convenience
string myvar ="Test";
You can user writeln(myvar) but not with UFCS: myvar.writeln;
I realized that UFCS would work only if the alias is defined
outside of main();
Is this a bug or a feature? Don't know if this can be solved.
Regards mt.
Regards mt.
More information about the Digitalmars-d
mailing list