Very interesting! Thanks for explaining.
There are two possible consequences to this, and I’m not sure which you’re objecting to. (Maybe both.)
Firstly, concurrency
's link
doesn’t have the desirable behaviour. It’s nothing to do with the choice of ThreadKilled
versus AsyncException
, it’s just to do with whether it suppresses whatever exception it uses from being rethrown to the parent.
Secondly, if you killThread
(via asyncThreadId
) an async
-link
ed thread, the ThreadKilled
will be thrown to you when the linked thread terminates. That’s bad!
It can happen because Async
is an abstract wrapper around a ThreadId
(and result/exception). Having a ThreadId
is a strong level of control over a thread! What would happen if we didn’t have
asyncThreadId :: Async a -> ThreadId
That sounds like it would be better encapsulation.
So, I’m not sure exactly what you’re objecting to, whether it’s firstly that the design of concurrency
itself is lacking, or whether, secondly, it composes poorly with other libraries.
Having said that, perhaps “significant change in a behavior that breaks code written for stock libraries” means that code written against the async
API won’t work when ported directly to the concurrency
API.
Thanks!