On Thursday, 9 February 2017 at 05:40:01 UTC, Jonathan M Davis
wrote:
The import is only listed once, whereas with this technique,
you have to list it for each symbol. e.g.
auto foo(from!"std.datetime".SysTime st1,
from!"std.datetime".SysTime st2,
from!"std.datetime".Duration d);
The result is much more verbose, and if you have several
symbols that need imports between the return type, parameters,
and template constraint, you quickly end up with a lot of extra
text in the middle of your function signatures just because you
want to tie the imports to the functions that use them.
- Jonathan M Davis
Thank you for your insightful feedback, I'm currently pressed for
time but I can at least begin to address one of your concerns.
Every proposed solution has some sort of tradeoff, verbosity
could be dealt with for the price of turning a simple function
into a template. In some cases this could be acceptable in others
prohibitive.
auto
foo(alias dt = from!"std.datetime")
(dt.SysTime st1,
dt.SysTime st2,
dt.Duration d)
Our "Implicit Function-Template Instantiation" also unfortunately
bails with default arguments... maybe there is an enhancement
request for that already?
@(from!"std.datetime") almost works too(it would avoid turning
the function into a template), but has other issues.