Tuesday, 9 March 2010

Non Blocking Language

E is a language that has threading built in so that high level language programmers do not need to deal with it. It is based on the idea of promises. If I understand it correctly the basic idea is that you can call a long running method on an object in such a way as to obtain is another object called a promise. The function call returns immediately and the promise object can be used as though it were a real object so you can carry on calling methods. Meanwhile the real function call is running in the background.

There is a statement that waits for promises to become real objects. It looks very much like try..catch..finally. The difference is that it sets up a thread and the statement following executes immediately. The body of the wait will be executed when all of the promises have been fulfilled, that is, the real function calls have returned. The catch block executes if the promise fails to be fulfilled (network connection broken, timeout?).

Once you have a promise you can give it to someone else so that they can wait for it to be fulfilled instead of you.

Reminds me a little of occam.

No comments:

Post a Comment

Blog Archive

Followers