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

Janice Caron caron800 at googlemail.com
Thu Sep 13 12:13:57 PDT 2007


On 9/13/07, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> > It cannot be a library feature, because it cannot be implemented in a
> > library, because to implement it in a library, you'd need transitive
> > const, or logical const.
>
> I'm guessing that tango.core.sync.ReadWriteMutex successfully implements it
> using a library.  It'd probably be possible using templates to make wrappers
> as you have suggested.

You can certainly have mutexes in a library. No problem there. But
what you can't do is put them in a const object and expect them to
work. Not unless Walter explicitly decides to let you.

Remember the goal here is not /just/ to have an easy way to do
mutexes. It's also to allow a workaround for const transitivity.
Walter says const intransitivity (or mutable members) would not be
thread-safe - and he's right. So what we have here in this suggestion
of mine is mutable members which /are/ thread safe. And /that's/ what
you can't do in a library, because you don't have the very thing I
want to achieve!



More information about the Digitalmars-d mailing list