April 22, 2017
On Saturday, 22 April 2017 at 16:14:29 UTC, Timon Gehr wrote:
> Please reconsider. This is new syntax. It looks like old syntax but behaves differently.

I suppose the biggest issue is:

-----
module mod;
import std.stdio;

struct A
{
    ~this ( ) { writeln("dtor"); }
}
-----

-----
module test;

class C
{
    with (import mod) A a;  // declaration, lives as long as C lives

    void test ( )
    {
        with (import mod)  // statement
        {
            A a; // destroyed on exit of scope
        }

        // a was destroyed, and is not even visible here
    }
}
-----

I can see how this can be a pain point. If it's a big worry then I'd be ok with using one of the syntactic alternatives, like 'import (std.stdio);'.
April 22, 2017
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?
April 23, 2017
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
April 23, 2017
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote:
> 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.

Wouldn't there be a compile-time performance impact from instantiating so many templates, virtually for every parameter who's type is defined in another module?
April 23, 2017
On 2017-04-23 14:03, Andrei Alexandrescu wrote:

> 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.

Absolutely, that's great. But I would have thought that the DIP would get retracted by the author, or do you still want to see this in the language?

-- 
/Jacob Carlborg
April 23, 2017
On Sunday, 23 April 2017 at 12:34:34 UTC, Andrej Mitrovic wrote:
> On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote:
>> 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.
>
> Wouldn't there be a compile-time performance impact from instantiating so many templates, virtually for every parameter who's type is defined in another module?

It's just one per module. Templates are only instantiated once per new set of arguments. There may be some gain here, but I doubt this is worth adding a new language feature.

April 23, 2017
On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote:
> Destroy!
>

I'm not per se against going there but there are 2 points that needs to be considered. The first one is the "self important lookup" which obviate the need for this DIP to some extent.

Second, if we are going to proceed anyway, the way this is specified is not ideal. This DIP effectively adds 2 features:
1/ The ability to use import foo as an argument to a with statement.
2/ The introducing of a with declaration in addition of a with statement.

These two addition are independents as far as the spec goes and should be kept as such as to avoid an explosion of ad hoc solutions for the use case we want to enable, rather than providing building blocks that combine nicely to build such solutions.
April 23, 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] ~ "){}");
}
April 23, 2017
On Sunday, 23 April 2017 at 16:39:35 UTC, deadalnix wrote:
> It's just one per module. Templates are only instantiated once per new set of arguments. There may be some gain here, but I doubt this is worth adding a new language feature.

Ah, good point.

Though there's still merit to this DIP such as this:

> With this syntax, the import is executed only if the declared name (process) is actually looked up.

I don't believe the workaround with the `from` template fixes this.
April 23, 2017
On Sunday, 23 April 2017 at 19:25:09 UTC, Andrej Mitrovic wrote:
>> With this syntax, the import is executed only if the declared name (process) is actually looked up.
>
> I don't believe the workaround with the `from` template fixes this.

Not sure what DMD does, but SDC sure would do it only if used.