Matching with std.concurrency receive

Adam Adam at
Sat Dec 10 13:23:28 PST 2011

Hm.. so I tried another approach, which would be to send the type
name as a string, then use Object.factory to instantiate that (ugly,
but whatever). Had a few problems with that, then just reduced it to
a non-thread case:

import std.stdio;

immutable interface BasicType {

immutable class SubType : BasicType {

immutable class A(T : BasicType) {

void main() {
    immutable A!(SubType) instance = new immutable(A!(SubType))();
    writeln("Type name is " ~;
    Object object = Object.factory(;
    if (object) {
    } else {

This returns "Failed." So, I thought I'd just provide Object.factory
"hello.A" (since hello is the module name and is what is printed
from the writeln). Still no good.

Any thoughts?

More information about the Digitalmars-d-learn mailing list