Extended Type Design.

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Sat Mar 17 21:39:53 PDT 2007


Walter Bright wrote:
> Derek Parnell wrote:
[snip]
>>> invariant
>>  This is applied to declarations to prevent code in the same 
>> application as
>> the declaration from being able to modify the item being declared.
> 
> Almost right. It isn't the declaration, but the *type* that is 
> invariant. Invariant applies to the type, not the name.

By the way, "invariant" is a lifesaver. Everybody and their sister in 
the coffee shop liked it at the first sight. The girl at the counter 
asked for kris' email :o).

Yes, "invariant" is essentially a synonym to "constant", but here are 
two simple mnemonic devices to remember which is which:

a) "const" is shorter because it's used more often;

b) "const" is similar to C++'s homonym.

Easier to remember than perl's $|.


Andrei



More information about the Digitalmars-d mailing list