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

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu Sep 13 15:10:27 PDT 2007


Janice Caron wrote:
> 
>> If it isn't possible to make such a smart pointer in D right now (and it
>> isn't) that's what should be fixed.  Then this proposal could be
>> implemented as a library.
> 
> No it couldn't. Not in D. Would you care to guess why not?
> 
> *Because const is transitive*
> 
> There is no way you could put a read/write mutex (which itself needs
> to be mutable) into a const structure unless it's done at a language
> level, because Walter won't let you.
> 
> 

Erm, you could always cast away the constness of the mutex, so I think 
it's possible. (even if not ideal)

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list