[Issue 9065] Please consider adding these std.traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 28 01:43:42 PST 2012


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



--- Comment #45 from Rob T <alanb at ucora.com> 2012-11-28 01:43:28 PST ---
(In reply to comment #43)
> The history of this was:
> 
> In D1, const XXX = YYY; declared a manifest constant. You couldn't take the
> address of it. With the change to const in D2, this no longer worked. I argued
> that we needed a way of doing manifest constants. Walter started implementing
> it as 'manifest'. Andrei argued for it to reuse 'enum' to reduce the number of
> keywords. Almost everybody was angry about overloading 'enum' and there was a
> huge fight, but Andrei won in the end. Yes it causes confusion.
> 
> They are not enums, there is nothing enumerated about them. It's just an
> overloaded keyword.

Interesting history, but the thing is that from a D users POV, it is a member
of an anonymous enum, and that does not change however it may be internally
represented, or historically thought of.

I look at it this way

enum { a = 2 } // anonymous enum set to 2 with one member
enum a = 2; // anonymous enum set to 2 with one member and optional {} removed
enum a; // anonymous enum unset with one member and optional {} removed

How is this not what the specification says it is? How it may be internally
represented is invisible to the user, what the user sees is only what is seen
in terms of how the language represents the concept. This is an enum, and if it
is not, then that only matters if it does not behave like all the other enum
members, otherwise it may as well be viewed as if it is an enum member. I
suspect this was Andrei's argument, because it actually does fit nicely into
place.

If I'm going to get mentally confabulated again because it does not work as I
would expect an enum to work, then I'll be up in arms about it for sure, so I'm
interested in knowing exactly how it is not like an enum, not internally, not
historically, but in terms of usage from a programmers POV?

-- 
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