documentation and papers about const/invariant
Bill Baxter
dnewsgroup at billbaxter.com
Tue May 20 09:03:13 PDT 2008
Sean Kelly wrote:
> This is why I don't like some of the decisions in D 2.0. Choosing 'enum',
> for example, to represent manifest constants. It takes a necessary hack
> from C (declaring constants as enum values because it's either that or
> #define and #define stinks) and formalizes it as the Right Way to declare
> manifest constants. Personally, I think that anonymous enums shouldn't
> be allowed at all--formalizing the approach is a disaster. I guess what
> I'm saying is that I simply don't accept the argument that D should
> support C syntax, even bad C syntax, simply in hopes that it will help
> gain acceptance from the C community.
Step 7 of the 12 step program for converting C++ to D is "global replace
'typedef' with 'alias'". It would not be hard to add a step 13: "global
replace 'enum' with 'manifest'" or 'constant' or some other word that
makes more sense than enum. So I really don't buy any argument that
says "enum" has to stay "enum" for the benefit of C++ folks.
For whatever reason, back in the day Walter realized that it was no
longer appropriate to call D's expanded typedef a typedef and so he gave
it a sensible name that matched its expanded role much better. I'm not
sure what's changed, but for some reason today he seems to have the
attitude of "eh, a word is a word. What's it matter what we call it?".
I have to agree with the pigs in Orwell's Animal farm on this one: "all
words are equal, but some words are more equal than others."
--bb
More information about the Digitalmars-d
mailing list