I was thinking about ways to improve std.concurrency w/o compromising its safety or the simplicity of what already works. Isn't it unnecessarily restrictive that a spawned function must return void? Since the spawned thread dies when the spawned function returns, the return value could safely be moved to the owner thread. Therefore, the return values wouldn't even have to be immutable/shared/lacking indirection. The return value could, for example, be stored in Tid, with attempts to retrieve it blocking until the spawned thread returns.
This would enable an important use of concurrency to be implemented safely and efficiently. Assume the input to a function is an immutable string specifying a filename. The output is a very complex data structure representing the data in the file. A main thread could then spawn a worker thread with the immutable string for input, and get the data structure without using any shared data or exposing the possibility of any race conditions. Is there some reason I'm missing why this doesn't already work?
