www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ...Or just rename enum

reply Bill Baxter <dnewsgroup billbaxter.com> writes:
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
parent reply "Janice Caron" <caron800 googlemail.com> writes:
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
parent reply guslay <guslay gmail.com> writes:
 
 If Walter doesn't like final, alias, macro, define or let, how about
"manifest"?
How about "magic"? magic int number = 42;
Dec 08 2007
parent reply "Craig Black" <craigblack2 cox.net> writes:
"guslay" <guslay gmail.com> wrote in message 
news:fjeu7m$i0$1 digitalmars.com...
 If Walter doesn't like final, alias, macro, define or let, how about 
 "manifest"?
How about "magic"? magic int number = 42;
Or wildebeast wildebeast int num = 42;
Dec 09 2007
parent reply "Janice Caron" <caron800 googlemail.com> writes:
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
parent reply sambeau <no-spam-for-sambeau mac.com> writes:
Janice Caron Wrote:

 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
how about 'def', 'define' or 'let'? define num = 42; def X { A=3, B, C } let num = 42; let X { A=3, B, C }
Dec 10 2007
parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On Mon, 10 Dec 2007 15:44:22 +0100, sambeau <no-spam-for-sambeau mac.com=
  =
wrote:
 Janice Caron Wrote:

 On Dec 9, 2007 11:56 PM, Craig Black <craigblack2 cox.net> wrote:
 Or wildebeast

 wildebeast int num =3D 42;
Best idea so far! But it's spelt "wildebeest". wildebeest num =3D 42; LOL
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 }
wildebeest is better. Or elephant. Those are even more constant, with = their big size.
Dec 10 2007