Fully transitive const is not necessary

Lars Ivar Igesund larsivar at igesund.net
Thu Apr 3 09:21:31 PDT 2008


Walter Bright wrote:

> Bill Baxter wrote:
>> So const isn't a guarantee of thread safety.
> 
> You're right, it isn't sufficient. But it is necessary.
> 
> 
>> Hey! That probably *is* thread safe, and it didn't even use const at all.
> 
> You can certainly write thread-safe code that doesn't use const at all.
> You just have to be careful not to change it - i.e. the checking will be
>   done by you, the programmer, rather than the compiler.
> 
>> I can see invariant having some value in conjunction with pure, but I
>> also suspect that invariant, being so strict, is also something that
>> will not get used a lot outside of simple constants and code carefully
>> designed for running in parallel.  Like what Don's said.
> 
> Invariant strings have turned out to be a resounding success (and I was
> very, very skeptical of that initially). I suspect that more and more
> programs will gravitate towards using invariant as people get more used
> to the idea. I know my programs will.

Do you have any references to this resounding success?

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list