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

Mathias Lang via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 04:01:40 PST 2016


On Wednesday, 14 December 2016 at 09:01:30 UTC, Joseph Rushton 
Wakeling wrote:
> On Wednesday, 14 December 2016 at 07:17:57 UTC, Jacob Carlborg 
> wrote:
>> On 2016-12-14 03:23, Andrei Alexandrescu wrote:
>>> On 12/13/16 9:22 PM, Hatem Oraby wrote:
>>
>>>> with(import std.range)
>>>> bool equal(R1, R2) if (isInputRange!R1 && isInputRange!R2)
>>>> { ... }
>>>
>>> I considered this, then figured with is superfluous. -- Andrei
>>
>> It could allow to have a better control of the scope which the 
>> import affects, i.e.:
>>
>> with(import std.range)
>> {
>>   void foo(T) if (isInputRange!T)
>>   void bar(T) if (isInputRange!T)
>> }
>
> Trouble is, there's no real difference between doing that, vs. 
> creating a standalone module containing `foo` and `bar` with 
> `import std.range;` as a top-level import.


That was my impression when reading this DIP. I'm very glad to 
see that decoupling made its way up in the growing list of things 
to do, my only concern is that this syntax sounds like a 
workaround for giant modules.

Phobos is cited as a motivation for this enhancement. Dare I say 
that we have a problem of modules in phobos being too monolithic, 
and they should be split into more packages, like std.range and 
std.algorithms did ?


More information about the Digitalmars-d mailing list