Most probably I'm being stupid here but cant you invent a new return type which cannot be assigned to a variable and cant be changed after returned from a proc? Then If threads:on, wouldnt it be possible to prove it that it is really not touched after its built in extra compiler pass ?
proc buildTree(inputs): "untouchable" Tree =
...
# var data = buildTree(..) # error
let data = buildTree(..) send data to some thread
Just a thought. Ignore it if its indeed a stupid idea.
