Extended Type Design.
Walter Bright
newshound at digitalmars.com
Tue Mar 20 16:01:35 PDT 2007
Bruno has answered your specific questions, so I'll take a more general
tack.
A symbol is a name to which is 'bound' a value.
static int x = 3;
'3' is the value.
'int' is the type.
'x' is the symbol.
'static' is the storage class.
Here, we bind a new value to the symbol x:
x = 4;
A storage class originally meant where the symbol is stored, such as in
the data segment, on the stack, in a register, or in ROM. It's been
generalized a bit since then. The main way to tell a storage class apart
is that:
1) a storage class applies to the symbol
2) a type is independent of storage class, i.e. you cannot create a type
that is "pointer to static" or "array of extern". Storage classes do not
affect overloading, nor type deduction.
'invariant' and 'const' are type modifiers (aka type constructors),
which mean when they are applied to a type, a new type is created that
is a combination.
'invariant' is a guarantee that any data of that type will never change.
'const' is a guarantee that any data of that type will never be modified
through a reference to that type (though other, non-const references to
that type can modify the data).
More information about the Digitalmars-d
mailing list