Walter is right about transitive readonly - here's the alternative

Jason House jason.james.house at gmail.com
Tue Sep 18 18:00:02 PDT 2007


Janice Caron wrote:
> - - - - conclusion - - - -
> 
> This is a viable, threadsafe alternative to both intransitive const
> and logical const.

I like your idea, but I have to disagree with this.  The proposal itself 
still needs some kind of const concept.  How do you enforce something 
which has a read lock is not written to?

I think a proposal that combines this and the latest Walter has 
suggested for const could resolve a lot the current issues that have 
been raised lately.

It sounds to me that if a class contains a shared member that the shared 
member would remain non-const, even if the class reference becomes const 
or invariant.

Other observations:
1. Having a read lock on a variable sounds equivalent to having a scope 
invariant variable.
2. Having a write lock forces only one writer, a concept that is not 
covered by Walter's const proposal.

Since I haven't really seen any motivating use cases for how the new 
const would be used and I don't fully appreciate how Walter's proposed 
design would truly satisfy the requirements, I'll stop my speculative 
language design here.




More information about the Digitalmars-d mailing list