[Issue 9065] Please consider adding these std.traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 28 08:15:00 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9065



--- Comment #51 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-11-28 08:14:54 PST ---
> An enumerated type must be integral (it must be countable!)

This is not true at all in D. An enum can be any type which can be compared and
can be use to directly initialize a variable at compile time. On top of that
including built-in types like strings, TDPL specifically talks about declaring
enums which are structs - and that's enums with a list of values, not manifest
constants. It's incredibly valuable to be able to have enumerated lists of
user-defined tpes rather than just integral values.

I have no problem whatsoever calling enums which are manifest constants
manifest constants rather than enums, but at the same time, the only
differences between them and normal enums are the fact that they don't have a
separate enum type and there's only one of them. Practically speaking, there's
really no other difference. Neither have addresses. They're just values that
get copy-pasted when used.

So, while I have no problem with the term manifest constant, I don't think that
it would cause any real problem to refer to them as anonymous enums instead. I
do kind of wish that we'd gone with the keyword manifest over enum to better
separate the two concepts, because manifest constants are actually enumerated,
but from a pratical point of view, it's really a non-issue IMHO. If anything,
normal enums are simply an enumeration of manifest constants.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list