archives

Cat Version 0.9

I've made a major update to the Cat manual and posted a new version of the Cat interpreter and source code which is now compatible with Mono (but so far only tested on Mono 1.13.8 under Windows XP). The type checker / type inference engine is now much more mature and well-tested.

The Cat interepreter and source code is all released entirely into the public domain.

Any comments, suggestions, or bug reports much appreciated!

Practical OCaml

Practical OCaml. Joshua Smith.

Apress has recently published a "mainstream" book (in English!) on OCaml. Here is an interview with the author, on a Ruby blog, of all places. I haven't seen the book yet, but will certainly buy it. If it's as good as Practical Common Lisp and generates as much buzz, this will be a very nice thing.

Continuations, yield, ES4

My language of choice for everyday coding is EcmaScript, thus I am very interested in everything new in this area. I'm mostly happy with the language, the only thing I miss in it seems to continuation support. I need them to simplify my work with asynchronous processing, that seems to happen very often in my development. I want them in order to convert this async processing to look like synchronous.

So for example when I need to perform a bunch of animations one after one I have to write just

for(var i=0;i<animations.length;i++)
  performAmination(animations[i])

What I need to write now instead is some hard to understand code.

Another asynchronous thing is communication with server (AJAX).

var someResult = serverProxy.callSomeFunc(arg);
var otherResult = serverProxy.callOtherFunc(someResult+1);

Now I am writing this in CPS stile, but it is a bit tedious.

serverProxy.callSomeFunc(arg,function(someResult){
  serverProxy.callOtherFunc(someResult+1, function(otherResult){
  //process something here
  });
})

With continuations I could hide all the async-sync conversion in proxy and all the code will just use it in synchronous way.
So basically, I want SJAX instead of AJAX :-)

I know that JavaScript 1.7 in Firefox 2.0 supports yield keyword and generators.
But I do not know whether it is possible to achieve such kind of conversion using only yield. So that is my first question - is that possible at all.

Rhino already has full continuations support, and such things is possible to do in Rhino, but there is no Rhino in web-browser and in Flash player.

And second question is - does somebody know whether ES4 will support continuations or just yield. Somewher I read that Brendan Eich promised continuations, but I didn't find this in ES4 draft.