DIP 1005 - Preliminary Review Round 1

Arturg via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 23 09:56:40 PDT 2017


On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu 
wrote:
> On 4/22/17 4:52 PM, Joakim wrote:
>> On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote:
>>> DIP 1005 is titled "Dependency-Carrying Declarations".
>>>
>>> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md
>>>
>>> All review-related feedback on and discussion of the DIP 
>>> should occur in this thread. Due to DConf taking place during 
>>> the review period, the period will be extended by a week. The 
>>> review period will end at 11:59 PM ET on May 13 (3:59 AM GMT 
>>> on May 14), or when I make a post declaring it complete.
>>>
>>> At the end of Round 1, if further review is deemed necessary, 
>>> the DIP will be scheduled for another round. Otherwise, 
>>> because the DIP comes from a language author and no formal 
>>> review period by the language authors is necessary, the DIP 
>>> will be marked "Accepted" or "Rejected" at the author's 
>>> discretion.
>>>
>>> An extensive discussion regarding this DIP has already taken 
>>> place [1].
>>>
>>> Thanks in advance to all who participate.
>>>
>>> Destroy!
>>>
>>> [1] 
>>> http://forum.dlang.org/thread/o2psvk$1m96$1@digitalmars.com?page=1
>> 
>> I thought this DIP was invalidated by the self-important 
>> workaround?
>> 
>> http://forum.dlang.org/post/o72kq8$ggc$1@digitalmars.com
>> 
>> https://github.com/dlang/druntime/pull/1756#issuecomment-277463742
>> 
>> Why is this still up for review?
>
> Mostly out of a sense of conformity. We asked Michael to give 
> no special treatment of DIPs originating from us, and this one 
> was open, so he put it up for review. It is likely it will end 
> up rejected in favor of 
> https://github.com/dlang/druntime/pull/1756.
>
>
> Thanks,
>
> Andrei

this example doenst work with the from!"modName" template, would 
it work with dip1005?

module moda;

struct Foo{int i;}

module modb;

void fun(from!"moda".Foo){}

module app;

template test(alias f)
{
     mixin("void test(" ~ 
from!"std.traits".Parameters!f.stringof[1..$-1] ~ "){}");
}

void main()
{
     import moda, modb;
     test!fun(Foo(5));
}

could dip1005 be introspected?

// you can make the above work with this or is there a better way?
template test(alias f)
{
     import traits;
     enum paramImports =
     {
string res;
         foreach(p; Parameters!f)
         {
            static if(!isBuiltinType!p) res ~= "import " ~ 
moduleName!p ~ ";\n";
         }
         return res;
     }();

     mixin(paramImports);
     mixin("void test(" ~ Parameters!f.stringof[1..$-1] ~ "){}");
}


More information about the Digitalmars-d mailing list