digitalmars.D - ...Or just rename enum
- Bill Baxter (17/17) Dec 07 2007 Another possibility occured to me.
- Janice Caron (12/13) Dec 08 2007 I'd want to keep the ability to make new types. I grant you that D's
- guslay (2/4) Dec 08 2007 How about "magic"?
- Craig Black (4/9) Dec 09 2007 Or wildebeast
- Janice Caron (4/6) Dec 10 2007 Best idea so far! But it's spelt "wildebeest".
- sambeau (6/16) Dec 10 2007 how about 'def', 'define' or 'let'?
- Simen Kjaeraas (4/21) Dec 10 2007 wildebeest is better. Or elephant. Those are even more constant, with =
Another possibility occured to me. Get rid of the keyword enum and replace it with something that would better describe the full scope of the new proposed usages. For a time, we add a new keyword. But slowly phase out enum. Maybe issue deprecation warnings after 6 months, then make it a deprecation error after a year. Something like that. So what to call the new "enum" replacer? "constant"? And maybe the actual automatically numbered meaning of enum would have a slightly different syntax. Something to say "hey enumerate these". I think that can be done without another keyword. If no other means then by a paren option like "constant(enum)". Thoughts? Really I have no problem merging the /concepts/ of enum and manifest constants. That really does make sense. The problem is just the actual keyword involved here. --bb
Dec 07 2007
On 12/8/07, Bill Baxter <dnewsgroup billbaxter.com> wrote:Thoughts?I'd want to keep the ability to make new types. I grant you that D's enums aren't proper enums, but they still let me pretend that they are: enum MyType { /*...*/ } MyType x; My preference would be leave enums as-is, although perhaps it would be nice to forbid overlapping values (e.g. enum { x=3, y=3 }), and also to forbid enums which have fewer than two entries (thereby forcing people /not/ to use them for manifest constants). ...and to come up with a different syntax for manifest constants. If Walter doesn't like final, alias, macro, define or let, how about "manifest"?
Dec 08 2007
If Walter doesn't like final, alias, macro, define or let, how about "manifest"?How about "magic"? magic int number = 42;
Dec 08 2007
"guslay" <guslay gmail.com> wrote in message news:fjeu7m$i0$1 digitalmars.com...Or wildebeast wildebeast int num = 42;If Walter doesn't like final, alias, macro, define or let, how about "manifest"?How about "magic"? magic int number = 42;
Dec 09 2007
On Dec 9, 2007 11:56 PM, Craig Black <craigblack2 cox.net> wrote:Or wildebeast wildebeast int num = 42;Best idea so far! But it's spelt "wildebeest". wildebeest num = 42; LOL
Dec 10 2007
Janice Caron Wrote:On Dec 9, 2007 11:56 PM, Craig Black <craigblack2 cox.net> wrote:how about 'def', 'define' or 'let'? define num = 42; def X { A=3, B, C } let num = 42; let X { A=3, B, C }Or wildebeast wildebeast int num = 42;Best idea so far! But it's spelt "wildebeest". wildebeest num = 42; LOL
Dec 10 2007
On Mon, 10 Dec 2007 15:44:22 +0100, sambeau <no-spam-for-sambeau mac.com==wrote:Janice Caron Wrote:wildebeest is better. Or elephant. Those are even more constant, with = their big size.On Dec 9, 2007 11:56 PM, Craig Black <craigblack2 cox.net> wrote:how about 'def', 'define' or 'let'? define num =3D 42; def X { A=3D3, B, C } let num =3D 42; let X { A=3D3, B, C }Or wildebeast wildebeast int num =3D 42;Best idea so far! But it's spelt "wildebeest". wildebeest num =3D 42; LOL
Dec 10 2007