Workaround for DIP 1005

Dominikus Dittes Scherkl via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 10 05:28:43 PST 2017


On Thursday, 9 February 2017 at 05:40:01 UTC, Jonathan M Davis 
wrote:
> On Friday, February 03, 2017 14:43:01 Dominikus Dittes Scherkl 
> via Digitalmars-d wrote:
>> Any thoughts?
>
> This is really cool, but I have a couple of concerns about this 
> and how it seems deficient in comparison to DIP 1005.
Of course. This is why I called it a "workaround".
But in fact I would prefer to only use local imports instead of 
some impoting template. But with this workaround in mind, the
implementation of DIP1005 would be much easier (see below).

> [...]
> The other problem is how much more verbose it is. With DIP 
> 1005, you can do
>
> with(import std.datetime)
> auto foo(SysTime st1, SysTime st2, Duration d);
>
> 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);
>

With my original proposal you would write

auto foo(foo.M.SysTime st1,
          foo.M.SysTime st2,
          foo.M.Duration d)
{
    import std.datetime;

}





More information about the Digitalmars-d mailing list