What purpose to const besides functional programming?

David Gileadi foo at bar.com
Thu Jul 24 16:28:30 PDT 2008


Walter Bright wrote:
> You're imputing meaning to an "invariant function" that isn't there. An 
> invariant function is a function that does not change the state of the 
> object it is a member of. It can change other state.

At the risk of exhuming and beating a dead horse, this was why I liked 
the proposal for using invariant(this) and const(this) for member 
function definitions.  More verbose, but also IMHO quite a bit clearer.



More information about the Digitalmars-d mailing list