DIP42 - Add enum E(T) = expression; eponymous template support

Kenji Hara k.hara.pg at gmail.com
Tue Jun 25 18:01:28 PDT 2013


2013/6/26 Walter Bright <newshound2 at digitalmars.com>

> On 6/25/2013 2:33 PM, Andrej Mitrovic wrote:
>
>> On Tuesday, 25 June 2013 at 21:31:15 UTC, Walter Bright wrote:
>>
>>> http://wiki.dlang.org/DIP42
>>>
>>
>> I suppose the alias version will work too? IOW:
>>
>> alias Select(size_t idx, T...) = T[idx];
>>
>> static assert(is(Select!(0, int, float) == int));
>> static assert(is(Select!(1, int, float) == float));
>>
>
> That's something separate.
>

I don't think so. DIP42 should consider alias version, from the grammatical
view.

enum basically takes an expression,

  enum E(T) = expression;

But alias should take a type grammatically.

  alias A(T) = type;


And one more question: How template constraint will be written?

  enum E(T) if (isSomething!T) = expression;   // is this supposed?

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130626/54d1613e/attachment.html>


More information about the Digitalmars-d mailing list