On Tuesday, 8 April 2014 at 21:21:22 UTC, Walter Bright wrote:
On 4/8/2014 2:16 PM, Dicebot wrote:
On Tuesday, 8 April 2014 at 21:12:10 UTC, Walter Bright wrote:
6. An integral type, some of which have names:

enum Color {
   Red = 0xFF0000,
   Green = 0x00FF00,
   Blue = 0x0000FF00,
   Fred = 0x123456,
   White = 0xFFFFFF }

This is not an integral type but collection of named constants with shared qualified path. Probably most common use case and one that should not have been
part of enum design but a separate concept.

The thing is, I want to be able to name that type:

    void setColor(Color newcolor) { ... }

Having a bunch of named constants doesn't do that.

With current D type system this gives you pretty much nothing over `(uint newcolor)`. Still can have any integral value.

Reply via email to