Extended Type Design - existing keywords

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Mar 16 15:34:17 PDT 2007


kris wrote:
> How about this? Using existing keywords, with a rename of "const":
> 
> 1) final       - rebinding of a value to a name
[moved '2)']
> 3) constant    - a value that never changes

These two are fine by me.

 > 2) invariant   - a read-only view of a data structure

No. Just No.
For one thing, the data structure can vary :) : anyone with a mutable 
reference can change the value from under your nose, so "does not vary" 
simply isn't applicable here.
But more importantly, invariant has a very clear and defined meaning in 
computer science. It should not be overloaded like this.



More information about the Digitalmars-d mailing list