DIP10005: Dependency-Carrying Declarations is now available for community feedback
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 1 21:06:17 PST 2017
On Mon, 02 Jan 2017 00:47:41 +0000, pineapple wrote:
> On Saturday, 31 December 2016 at 17:02:55 UTC, Chris Wright wrote:
>>> This extension removes an unforced limitation of the current with
>>> syntax (allows it to occur at top level)
>>
>> In other words, another aspect of this DIP is that I can write:
>>
>> module foo;
>> static import std.traits;
>> static import bar;
>> with (std.traits)
>> {
>> template Foo(T) if (isAbstractClass!T) {}
>> }
>> with (bar.SomeEnum)
>> {
>> enum something = SomeEnumValue;
>> }
>
> This is the only expression of the feature I've seen so far that makes
> intuitive sense to me.
>
> I'm still not sold on it being a worthy addition but, if it were, then
> this is the most promising syntax I've seen so far.
This is a minor part of the proposal that's mentioned as an aside,
though, and I'm not even sure it was even intentional.
This alone doesn't get the two benefits Andrei is most after --
specifically, that you can add the import in place without going to the
top of the file and that you can move the declaration to another module
without worrying about imports.
More information about the Digitalmars-d
mailing list