DIP10005: Dependency-Carrying Declarations is now available for community feedback
rikki cattermole via Digitalmars-d
digitalmars-d at puremagic.com
Wed Dec 14 03:06:27 PST 2016
On 14/12/2016 11:33 AM, Andrei Alexandrescu wrote:
> Destroy.
>
> https://github.com/dlang/DIPs/pull/51/files
>
>
> Andrei
Others have brought up similar syntax to this:
import(my.mod).Type!argsT(7)
import(Identifier).Identifier
It shouldn't be confused with string imports or the like and would be
more akin to a selective import.
Pros:
- Is an expression
- Relatively clear and in line with string imports as an expression
Cons:
- Another language feature to learn (but if I was designing a new
language, this would totally be in it)
- More text that goes into template constraints
- Personally I find if I need an import like this in one constraint, I
want it in a lot more places
- Much longer lines!
```D
void func(T)(T x)
if (import(std.traits).isBasicType!T ||
import(std.traits).isFloatingPoint!T) {
}
```
More information about the Digitalmars-d
mailing list