best way to handle UFCS with ambiguous names: using std.typetuple.Alias!
Jakob Ovrum
jakobovrum at gmail.com
Tue Jun 11 12:00:16 PDT 2013
I think selective, renamed imports are much better.
On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote:
> * library solution, already works, no need to add new syntax
> * 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)
The search will yield the site of renaming, where the alias can
be found and included in the search. It's not overly troublesome.
Most good renames might include the original name as part of the
alias anyway, in which case all you might need is
case-insensitive search.
> * systematic way to handle the such cases, whereas renamed
> local imports
> require to 'guess' a good name, eg import std.file:write2=write;
Do you "guess" identifier names when you introduce other symbols,
too?
> * 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).
Conflicts are very rare and the rename can be included at
function scope which is often going to be feasible.
Also, a separate import statement is not necessary in cases where
selective imports are already used.
More information about the Digitalmars-d-learn
mailing list