Thread overview
[Issue 10552] New: Cannot apply access specifiers to individual anonymous enum members
Jul 05, 2013
Andrej Mitrovic
Jul 06, 2013
Henning Pohl
Jul 06, 2013
Kenji Hara
Jul 06, 2013
Henning Pohl
Jul 06, 2013
Andrej Mitrovic
Jul 09, 2013
Walter Bright
Jul 09, 2013
Walter Bright
July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552

           Summary: Cannot apply access specifiers to individual anonymous
                    enum members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-05 14:00:15 PDT ---
-----
enum
{
    private A = 1,
    B = 2,
}
-----

$ dmd test.d
> Error: basic type expected, not private

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 06, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |henning@still-hidden.de


--- Comment #1 from Henning Pohl <henning@still-hidden.de> 2013-07-05 19:27:42 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2304

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 06, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-07-06 00:47:36 PDT ---
(In reply to comment #0)
> -----
> enum
> {
>     private A = 1,
>     B = 2,
> }
> -----
> 
> $ dmd test.d
> > Error: basic type expected, not private

I cannot see any benefits there.
You can just separate public anonymous enum and private one.

private enum
{
    A = 1,
}
enum
{
    B = 2,
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 06, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552



--- Comment #3 from Henning Pohl <henning@still-hidden.de> 2013-07-06 05:17:51 PDT ---
(In reply to comment #2)
> I cannot see any benefits there.
> You can just separate public anonymous enum and private one.
> 
> private enum
> {
>     A = 1,
> }
> enum
> {
>     B = 2,
> }

This has some drawbacks:

1) You have to write a new enum.
2) You cannot take advantage of the properties of anonymous enums.
3) Constants that belong together need to be defined at the same place.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 06, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-06 07:08:29 PDT ---
(In reply to comment #2)
> (In reply to comment #0)
> > -----
> > enum
> > {
> >     private A = 1,
> >     B = 2,
> > }
> > -----
> > 
> > $ dmd test.d
> > > Error: basic type expected, not private
> 
> I cannot see any benefits there.
> You can just separate public anonymous enum and private one.
> 
> private enum
> {
>     A = 1,
> }
> enum
> {
>     B = 2,
> }

I see it as an unnecessary limitation, each member can have its own type and its own initializer (even its own UDA), but not an access specifier. Note that due to Issue 10552 we can use neither syntax.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10552



--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2013-07-09 12:20:51 PDT ---
Language changes are enhancements, not bug fixes.

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