std.concurrency & immutable classes...
Jonathan M Davis
jmdavisProg at gmx.com
Sun Feb 6 14:51:03 PST 2011
On Sunday 06 February 2011 13:55:36 Tomek Sowiński wrote:
> ... doesn't work.
>
> class C {}
> thisTid.send(new immutable(C)());
> receive((immutable C) { writeln("got it!"); });
>
> This throws:
> core.exception.AssertError@/usr/include/d/dmd/phobos/std/variant.d(285):
> immutable(C)
>
> And when I go for Rebindable, I get "Aliases to mutable thread-local data
> not allowed.".
>
> Is there anything I can do?
>
> Overall, I think that's another reason D needs native tail const badly.
> Polymorphic classes are close to being second class citizens just as soon
> const enters. :(
Open a bug report on it. There are a number of bugs relating to const and
immutable - some of which are library-related and some of which need to be fixed
in the compiler. Until many of those get sorted out, I wouldn't expect using
immutable classes to work very well beyond some very basic cases.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list