On 11/28/2012 02:07 PM, tn wrote:
On Tuesday, 27 November 2012 at 21:16:41 UTC, Walter Bright wrote:
On 11/27/2012 9:51 PM, Manu wrote:
There's another you missed:
enum X = 10;
I would have imagined this would be semantically identical to E.A/E.B,
but the compiler seemed to view this as distinct in my experiments.

Those are not enums, they are manifest constants. What distinguishes a
manifest constant from, say:

    const Y = 11;

is that no storage is allocated for X, and X's address cannot be taken.

What distinguishes manifest constants from literals? Aren't manifest
constants just literal aliases? That is, if the following did work

alias Y = 11;

wouldn't that be exactly same as

enum Y = 11;

Perhaps using "alias" instead of "enum" would make the meaning clearer?


It would not be the same thing.

immutable int i = 11;

alias Y = i; // symbol alias
enum  Z = i; // literal constant

Reply via email to