Immutable Message Passing

Andrew Wiley wiley.andrew.j at gmail.com
Sat Dec 3 23:24:02 PST 2011


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?


More information about the Digitalmars-d mailing list