On 2011-02-06 16:55:36 -0500, Tomek Sowiński <j...@ask.me> said:

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

I just made this pull request today:
<https://github.com/D-Programming-Language/dmd/pull/>

If you want to test it, you're very welcome. Here is my development branch for this feature:
<https://github.com/michelf/dmd/tree/const-object-ref>

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to