2 problems I can't get my head around

Manu turkeyman at gmail.com
Tue Nov 27 02:51:45 PST 2012


On 27 November 2012 03:56, Walter Bright <newshound2 at digitalmars.com> wrote:

> On 11/27/2012 4:30 AM, Manu wrote:
>
>>     template isEnum(alias T) if(is(T)) {
>>
>
> It isn't clear what is desired here. Given:
>
> enum E { A, B }
>
> E is the enum tag name, which is quite different from the enum members A
> and B. And, the enum tag name is indistinguishable from the enum type.
> Furthermore, an enum member is indistinguishable from an enum value. So, I
> suggest instead:
>
>    isEnumType
>
> and:
>
>    isEnumValue
>

I accept. They seem like good names.

There's another you missed:
enum X = 10;
I would have imagined this would be semantically identical to E.A/E.B, but
the compiler seemed to view this as distinct in my experiments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121127/21b573b2/attachment.html>


More information about the Digitalmars-d mailing list