On Thursday, 10 October 2013 at 23:33:17 UTC, Jonathan M Davis
wrote:
I just don't see how you could avoid casting when passing
ownership of an
object from one thread to another without having a way to pass
an object
across threads without having to make it shared or immutable to
pass it.
Well, the restriction to only pass immutable and shared data is
simply enforced statically by the API. So if there were an
assumeUnique analog, the check could be modified to accept that
as well, and then the class would arrive as unshared. This could
be accomplished pretty easily. It would be yet another step
towards not having thread-local pools though. I was initially
pretty conservative in what was an acceptable type to send,
because it's always easier to loosen restrictions than tighten
them.