Bug 10552 – Cannot apply access specifiers to individual anonymous enum members

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-05T14:00:00Z
Last change time
2016-08-27T21:00:31Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-07-05T14:00:15Z
----- enum { private A = 1, B = 2, } ----- $ dmd test.d > Error: basic type expected, not private
Comment #1 by henning — 2013-07-05T19:27:42Z
Comment #2 by k.hara.pg — 2013-07-06T00:47:36Z
(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, }
Comment #3 by henning — 2013-07-06T05:17:51Z
(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.
Comment #4 by andrej.mitrovich — 2013-07-06T07:08:29Z
(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.
Comment #5 by bugzilla — 2013-07-09T12:20:51Z
Language changes are enhancements, not bug fixes.
Comment #6 by bugzilla — 2014-06-02T00:19:52Z
I don't see much value in this enhancement.
Comment #7 by andrej.mitrovich — 2016-08-27T21:00:31Z
(In reply to Walter Bright from comment #6) > I don't see much value in this enhancement. That makes two of us. :) Closing.