Const sucks
Derek Parnell
derek at psych.ward
Mon Sep 10 14:58:10 PDT 2007
On Mon, 10 Sep 2007 12:55:29 -0700, Gregor Richards wrote:
> Derek Parnell wrote:
>>> o const and invariant now mean "fully const" and "fully invariant",
>>> where fully means "head and tail combined":
>>
>> Remind me again what the difference between 'const' and 'invariant' is.
>
> const: I promise not to change this, but acknowledge that somebody else
> might.
>
> invariant: Neither I nor anyone else will change this.
>
> const has a more limited use for optimization than invariant, since the
> value could be changed by other threads/programs-with-shm/whatever from
> under you.
>
> - Gregor Richards
>
> PS: Or at least, this is my understanding :)
Thank you. I do rememeber now ... silly how I couldn't get that from the
keywords.
'const' is sort of a locally write protected.
'invariant' is globally write protected.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list