News

muvee Reveal - the latest incarnation of muvee's flagship product - has just been released on 11 June 2008! The behaviours of the 8 bundled styles are specified using muSE, in addition to all the styles developed for the now discontinued muvee autoProducer 6.1.

Tuesday, July 31, 2007

spawn behaviour changed in v295

The spawn function has different semantics from v295 of muSE.

Prior to v295, spawn took a thunk and evaluated it in a separate process repeatedly until the thunk evaluated to a non-() value. This was done to make it simpler to write server processes that run the same code over and over until some condition occurs that makes it terminate.

Since v250, muSE has had support for stack optimized tail recursion and lazy evaluation. This means we can now write server processes as tail recursive functions that never terminate. Therefore we don't need the extra help provided by the spawn function any more.

From v295, (spawn thunk) will cause (thunk) to be evaluated only once and it will discard the result.

Expressing server processes as tail recursive functions, besides stating the obvious, gives you new ways to modularize parts of the server. If your server needs to be placed into modes when it receives certain input, each of these modes can be expressed as tail recursive functions that revert back to the main server function whenever an exit mode message is received.

No comments: