www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10818] New: Allow parameterized enum declaration

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10818

           Summary: Allow parameterized enum declaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



Aggregate declarations could have optional template parameters.

class C1 {}
class C2(T) {}

interface I1 {}
interface I2(T) {}

struct S1 {}
struct S2(T) {}

union U1 {}
union U2(T) {}

Similarly, parameterized enum declaration would increase language consistency.

enum E1 {}
enum E2(T) {}
enum E2(T) if (constraint) {}
enum E2(T) : T {}
enum E2(T) if (constraint) : T {}
enum E2(T) : T if (constraint) {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10818


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2474

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10818


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



20:48:24 PDT ---
Are there any existing use cases that this would improve?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 16 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10818





 Are there any existing use cases that this would improve?
I don't have actual use case. I'm proposing this enhancement just for increasing language consistency. --- Now I'm opening a compiler PR to extend DIP42 feature. https://github.com/D-Programming-Language/dmd/pull/2467 This is necessary to support `enum bool x(T) = initializer` syntax, and looks to me it is very similar to N3651 in C++14. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3651.pdf - aggregates, functions, and variable declarations. And, at that time enum declaration would be remained just one declaration which cannot be parameterized. That would be inconsistent. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2013