Manifest constants - why not 'alias' ?

Ary Borenszweig ary at esperanto.org.ar
Thu Dec 6 17:55:38 PST 2007


Walter Bright wrote:
> Bill Baxter wrote:
>> Enum is short for 'unumeration'.  But manifest constants aren't 
>> enumerating anything.  It makes no sense.
> 
> Because we already use enums to declare constant values.
> 
> enum { x = 3 }

That is a trick to declare a constant. You can also do this:

class Constants {

	static int x = 3;

}

And then you refer it as

Constants.x

So a possible syntax for defining constants could be

class static int x = 3;



More information about the Digitalmars-d mailing list