Extended Type Design.

Alex Burton alexibu at mac.com
Sun Mar 18 02:38:23 PDT 2007


Andrei Alexandrescu (See Website For Email) Wrote:

> 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

Another option I'd like to have at least considered is the finding of a character that can be used to denote const.
Adding various constnesses to all the code could easily add a whole lot of typing to the task of getting things done in D.

Could we find a unicode character that wouldn't be too much trouble for editors to insert ? Might mean that D starts to require unicode source - but is that such a bad thing ?

Are there any ascii characters that can be found that wont confuse the parser ? - like how the use of ! works for templates

Alex



More information about the Digitalmars-d mailing list