"Joachim Durchholz" <[EMAIL PROTECTED]>: > > I don't fully understand the decision though. One of the highlights of > FPLs is that you have as little state as possible, yet the concurrency > mechanism of Alice uses shared state - or did I get that wrong?
It /can/ use shared state, though that is not necessarily /the/ concurrency mechanism (which arguably would be futures). This is extending the basic design choice of ML, which discourages state, but when you need it it is there. Also note that most communication mechanisms for concurrency -- e.g. message queues a la Erlang -- are really only higher-level abstractions of shared state. Alice ML does not provide these as primitive, but rather follows the ML philosophy of providing the right, orthogonal primitives that you need to build them. In this case you need some form of shared state. > The VM could still exit when no useful work is in the system anymore. > E.g. when all threads have an empty message queue, and no asynchronous > requests to external entities (keyboard, timer, file system etc.) are > pending anymore. The problem is that it is generally undecidable to check whether this condition is true - it boils down to the halting problem. So you would have to rely on some ad-hoc criteria, which is not nice. Also, with distributed programming, there can potentially be external incoming RPC calls that would spawn new threads anytime. > > Furthermore, relying on implicit exit would necessary require you >> to know whether, say, a library that you are using spawns threads - >> which >> violates abstraction. > > No, the idea is that the main thread is charged with setting the > program's return code. > The library might want to set the return code, too. In that case, it > would have to provide a function that returns the return code. That's not what I meant. You said the VM should exit when the "last" thread has gone. But to actually make /use/ of this semantics to terminate an app, you have to know which threads are there (otherwise your app will not exit, or maybe exit prematurely). That knowledge alone would violate abstraction. - Andreas _______________________________________________ alice-users mailing list [email protected] http://www.ps.uni-sb.de/mailman/listinfo/alice-users
