std.concurrency & immutable classes...

Tomek Sowiński just at ask.me
Sun Feb 6 13:55:36 PST 2011


... 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. :(

-- 
Tomek



More information about the Digitalmars-d-learn mailing list