www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Immutable Message Passing

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?
Dec 03 2011