Fully transitive const is not necessary
Steven Schveighoffer
schveiguy at yahoo.com
Tue Apr 1 14:04:18 PDT 2008
"Craig Black" wrote
> One idea that I had recently was that the const keyword could provide
> logical const (for developers) and the invariant keyword could provide
> transitive const (for the compiler).
Making D not support logical invariant does not make it impossible to have
logically invariant functions as I have already demonstrated. If there is a
way to legally implement logical invariant, then I think the language should
not impose that restriction. Imposing a restriction that you cannot have
logical invariance is just going to be a nuisance for those who want to do
it, and it does not provide any benefits for compiler optimization.
The only place where it is important to ban logical const is for pure
functions as far as I can tell, and that can be dealt with when pure
functions are introduced.
-Steve
More information about the Digitalmars-d
mailing list