Immutable Message Passing
Jonathan M Davis
jmdavisProg at gmx.com
Sat Dec 3 23:42:46 PST 2011
On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote:
> This should work, right? I'm not just going crazy or something?
>
> import std.concurrency;
> import std.stdio;
>
> class Bob {
> }
>
> void main() {
> auto tid = spawn(&b);
> tid.send(new immutable(Bob)());
> }
>
> void b() {
> receive(
> (immutable(Bob) b) {
> writeln("got it");
> }
> );
> }
>
>
> I'm getting this from both GDC (trunk) and DMD (2.056 and trunk - I
> can't seem to get 2.055 to run):
> core.exception.AssertError@/usr/include/d/std/variant.d(286): immutable(Bob)
>
> Seems like some type conversion isn't working properly and variant is
> flagging immutable types as not assignable?
Well, that particular assertion seems to be because of the immutability. It
seems that Variant can't handle it - the comment with it being
// type is not assignable
But I'd have to go digging to see why on earth this is failing (and that's
assuming that it's not a compiler bug, since then it would be completely out
of my league). It _looks_ like it should work.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list