Am 28.03.2015 um 21:51 schrieb Walter Bright:
On 3/28/2015 1:32 PM, Sönke Ludwig wrote:
I/O is crucial of course, but there are also a lot of other important and
inherently impure things such as message passing.


If the message channel is passed as a parameter to the droutine, then
the droutine can still be pure.

Only if the methods of the channel are also pure. But they potentially have to interact with the system event loop, which involves impure system API calls.

I think such a restriction
would go way too far. Both fiber and task local storage can also be
very useful
at times, so it would be a pity to rule them out completely.

You'd also usually have the whole application running on "droutines"
and not
simply use them as a local tool for occasional parallelism needs. This is
especially true for any kind of server application. So effectively such a
limitation may in practice end up as a limitation of the entire language.

On the other hand, if purity can make droutines much more practical, the
tradeoff might be worth it.

If you ask me, they are very practical as they are - in fact much more practical than if they could move between threads, not just because of purity or not. I'm for example heavily using vibe.d's tasks for all kinds of UI, 3D graphics, sound and physics related things. All of these require calling various C libraries that are not be compatible with such a scheme.

We could of course add an optional pure+moving mode for those that absolutely need it, but IMHO we should first have hard evidence for practical performance improvements before going such a route.

Reply via email to