alias SyncData = immutable(JSONValue);

void worker(string filename) {
  SyncData data = filename.readText.parseJSON;
  send(ownerTid, data);
}

void main(string[] args) {
  spawn(&worker, args[1]);
  writeln(receiveOnly!SyncData);
}

I'm trying to send this immutable(JSONValue) back to the main thread but when trying to compile, I get the following error:

/usr/include/dmd/phobos/std/concurrency.d(764): Error: cannot modify immutable expression ret.__expand_field_0 cc.d(15): Error: template instance `std.concurrency.receiveOnly!(immutable(JSONValue))` error instantiating

Can anyone help out?

Reply via email to