[Swift-devel] karajan compiler

Mihael Hategan hategan at mcs.anl.gov
Sat Jun 7 18:21:49 CDT 2008


In the past week I've been playing a little with trying to see how
viable such an idea would be. It seems like it is.

The difficulty was in keeping lightweight threading in. This seems to be
doable pretty efficiently with a fair amount of switch statements.
Though trying it on real things would probably reveal the need for some
adjustments.

I also wanted to have proper lexical scoping, in the style of ML. That
also seems to be working fairly well.

The third part was some type system, and it turns out type inference was
also easy to put in. So the end result is something that is statically
scoped, but type annotations are optional. In terms of Swift this would
translate into an easier implementation of the Swift type system, which
is currently quite contrived.

Speeds seem to be in the range of about 1.5 orders of magnitude faster
(50x) (mostly due to the fact that context switches happen in a more
regular fashion).

I'll be committing the code in a separate module in cog at some point in
the future, so that others can play with it (though I suspect others
means Ben), even if it may never see more development. It's, of course,
missing a lot of things.

Mihael




More information about the Swift-devel mailing list