DIP10005: Dependency-Carrying Declarations is now available for community feedback

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 15 10:09:07 PST 2016


On 12/15/2016 01:06 PM, Andrej Mitrovic wrote:
> On Thursday, 15 December 2016 at 17:07:35 UTC, Dominikus Dittes Scherkl
> wrote:
>> On Thursday, 15 December 2016 at 16:16:51 UTC, Walter Bright wrote:
>>> On 12/14/2016 5:26 AM, Dominikus Dittes Scherkl wrote:
>>>> Why not leave it as it is and only change the compiler to
>>>> perform inputs _within_ a function before evaluating the
>>>> declaration, so that
>>>> the symbols imported can be used in the declaration?
>>>>
>>>> e.g.
>>>>
>>>> fun(Range x) if(isInputRange!x)
>>>> {
>>>>    import std.range;
>>>>    auto a = x.front();
>>>> }
>>>
>>> That would make it problematic to have function declarations.
>> So, I no longer propose to change nothing except the internal compiler
>> behaviour.
>> Now I propose to additionally change the .di-file generation to also
>> add all local imports to the start of the declaration file, so that
>> having this file gives ALL dependencies of the declared stuff.
>
> This makes me think about the current .di generation. As far as I
> remember it only strips function bodies and leaves everything else
> intact. It could already try to remove unused imports. And in the future
> it could replace regular imports with auto-generated DCD-style imports.
>

Please make this an issue. Thanks! -- Andrei


More information about the Digitalmars-d mailing list