D-Programming-Language/dmd — pull request #2467 by 9rnsr (2013-08-12 17:29:32+00:00)
Title: Extend DIP42 proposal to more generic

When I implemented DIP42 in #2368, I treated specially the case of parameterized enum declaration. As its result, current DIP42 feature is mostly a grammatical anomaly and difficult to document it correctly.

And, current implementation does not accept following declaration.

```d
enum bool isIntegral(T) = is(T == int);
```

I think not supporting this would be unnatural.

----

For more consistent behavior and clean syntax, I'd propose to allow optional template parameters for *all* variable declarations. For example:

```d
auto var(T) = initializer; // template auto declaration
T var(T) = initializer; // template variable declaration
enum bool isIntergral(T) = initializer; // template variable declaration with prefix storage class 'enum'
```