Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 17:36:13 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 16:46:15 UTC, Diggory wrote: On Monday, 3 June 2013 at 12:13:30 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Mond

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Maxim Fomin
On Monday, 3 June 2013 at 16:46:15 UTC, Diggory wrote: On Monday, 3 June 2013 at 12:13:30 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 12:13:30 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a var

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Andrej Mitrovic
On 6/3/13, Andrej Mitrovic wrote: > Actually, I just figured out that we already have support for what > I've asked for. Well apparently switch/final switch doesn't work with subtyping, I'll try to file this as a bug.

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Andrej Mitrovic
On Sun, 02 Jun 2013 20:03 -0700, Jonathan M Davis wrote: > Your suggestion for an "invalid" value for the first enum value > was a good one and should be enough IMHO if you don't want the default enum > value > to be valid. Actually, I just figured out that we already have support for what I've

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Maxim Fomin
On Monday, 3 June 2013 at 11:12:10 UTC, Diggory wrote: On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: ... Thoughts? I think it is simpler to set a firs

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-03 Thread Diggory
On Monday, 3 June 2013 at 05:56:42 UTC, Maxim Fomin wrote: On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: ... Thoughts? I think it is simpler to set a first enum member as invalid. However, I like an idea of su

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Maxim Fomin
On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: ... Thoughts? I think it is simpler to set a first enum member as invalid. However, I like an idea of supporting analogue of @disable this() mark for any user-defin

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Jonathan M Davis
On Monday, June 03, 2013 05:27:03 Diggory wrote: > Sounds like the exact same feature as "@disable this()" but for > enums, so perhaps it would be better to follow that syntax? Except that disable this() is specifically for cases where a type _can't_ have a default value and do what it's designed

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Diggory
On Monday, 3 June 2013 at 02:23:18 UTC, Andrej Mitrovic wrote: Let's say you define an enum, which is to be used as a variable: enum Machine { X86, X86_64, } So off you go and let the users (or yourself) use this in code: - void main() { Machine machine; ... callSomethi

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Jonathan M Davis
On Monday, June 03, 2013 04:57:28 Andrej Mitrovic wrote: > On 6/3/13, Jonathan M Davis wrote: > > This is like how Java forces you to directly initialize things when it > > doesn't think that you've initialized them elsewhere. D did _not_ take > > that route. It when with have an init value for ev

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Andrej Mitrovic
On 6/3/13, Jonathan M Davis wrote: > Machine machine; > > if(something) > { > // do a bunch of stuff > machine = Machine.x86; > } > else > { > //do a bunch of other stuff > machine = Machine.x86_64; > } > > you'd be forcing people to directly initialize the machine variable even if

Re: Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Jonathan M Davis
On Monday, June 03, 2013 04:23:00 Andrej Mitrovic wrote: > Thoughts? What makes this different from normal variables? This could happen with any type. You're basically trying to force people to directly initialize things in case they have bugs if they don't. If they really care about it, they ca

Feature request: Attribute with which to enable the requirement of explicit-initialization of enum variables

2013-06-02 Thread Andrej Mitrovic
Let's say you define an enum, which is to be used as a variable: enum Machine { X86, X86_64, } So off you go and let the users (or yourself) use this in code: - void main() { Machine machine; ... callSomething(machine); } - And here's the problem: the enum variable w