Manifest constants - why not 'alias' ?

sambeau please-dont-spam-sambeau at mac.com
Thu Dec 6 18:36:24 PST 2007


David Gileadi Wrote:

> Bill Baxter wrote:
> > Alias makes a lot more sense to me than enum.
> > 
> > alias x = 5;
> > alias float[] y = [1.0,2.0,3.0];
> > 
> > Conceptually, the variable becomes an alias for the literal.
> > 
> > Enum is short for 'unumeration'.  But manifest constants aren't 
> > enumerating anything.  It makes no sense.
> > 
> > --bb
> 
> FWIW, alias makes the most sense to me out of the current crop of 
> suggestions.  To me it says that wherever I see the alias, it will be 
> replaced with whatever value the alias is for.  That seems to describe 
> manifest constants exactly.

This all makes sense as an implementation, but not as a language design.
You need to step back and look at the word 'enum' and ask yourself does it make sense?

Surely, if you are proposing to change the use of 'enum' in this significant way you should change it's name. Otherwise everyone will be confused.

Def, let, constants, defines,  ... , etc

They all have two advantages
1) they sound like what they do
2) they aren't a reuse of something that already does something

I know that many people always go on about how many reserved words a language has and treats it like a badge of honor. But we can't all be Lisp. I would rather use keywords that make sense than reuse the same keyword for more than one distinct use.. static, extrern, const, ..., blah! :-)
  



More information about the Digitalmars-d mailing list