Trouble with receiveOnly and immutable(JSONValue)

rx mr at
Thu Jan 10 17:15:27 UTC 2019

alias SyncData = immutable(JSONValue);

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

void main(string[] args) {
   spawn(&worker, args[1]);

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?

More information about the Digitalmars-d-learn mailing list