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

drug via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 05:45:24 PST 2016


14.12.2016 16:26, Dominikus Dittes Scherkl пишет:
> On Tuesday, 13 December 2016 at 22:33:24 UTC, Andrei Alexandrescu wrote:
>> Destroy.
>>
>> https://github.com/dlang/DIPs/pull/51/files
>
> 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();
> }
>
> this is especially more clean if a function needs several imports and
> maybe some of them in the declaration but not all of them. This would
> otherwise split the imports to two different points, some within the
> (already much too long) declaration and some within the function. I
> consider this ugly.

I think this is really smart way to solve the problem.


More information about the Digitalmars-d mailing list