<div>UFCS chains are problematic when a symbol is ambiguous (eg after import std.stdio:write;import std.file:write);</div><div><br></div>I previously suggested to add the syntax <div>'arg1.(std.file.write)(arg2)' </div>
<div>(see 'support UFCS with fully qualified function names (was in "digitalmars.D.learn")' to avoid breaking UFCS chains. </div><div><br></div><div>Others have suggested using renamed local imports:</div>
<div>import std.file:write2=write;</div><div><div>'arg1.write2(arg2)' </div></div><div><br></div><div>This issue keeps coming up, eg '<a href="http://forum.dlang.org/post/mailman.980.1370764406.13711.digitalmars-d@puremagic.com">http://forum.dlang.org/post/mailman.980.1370764406.13711.digitalmars-d@puremagic.com</a>', prompting some to prefer symbols with unique, redundant names eg std.compress.lzw.lzwCompress instead of std.compress.lzw.compress.</div>
<div><br></div><div>However I found a much better way:</div><div><br></div><div><b>import std. typetuple:Alias;</b></div><div><div><b>'arg1.Alias!(std.file.write).arg2'</b></div></div><div><br></div><div>Interestingly, I haven't found this pattern in phobos.</div>
<div><br></div><div>advantage:</div><div><br></div><div>* UFCS chain not broken; no loss of efficiency</div><div>* library solution, already works, no need to add new syntax</div><div>* avoids the renamed local imports, which I argue is a bad idea (makes it harder to search for usages of a function, ie 'grep' won't work)</div>
<div>* systematic way to handle the such cases, whereas renamed local imports require to 'guess' a good name, eg import std.file:write2=write;</div><div>* renamed local imports require 1 import declaration syntax per ambiguous UFCS function (eg import std.file:write2=write needed even if import std.file is already there), whereas a single import std.typetuple declaration handles all ambiguous cases).</div>
<div><br></div><div>Bigger example:</div><div>----</div><div><div><div>void main(){</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>import std.typetuple;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>import std.stdio;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>import std.file;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>import std.range;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>import std.algorithm;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>"hello2".Alias!(std.stdio.write);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>3.iota.map!(a=>a*a).Alias!(std.algorithm.reduce!"a+b").Alias!(std.stdio.writeln);</div>
<div>}</div></div></div><div><div>----</div><div><br></div><div><br></div><div></div></div>