4 ms·
I've been working on a port of Atomo (http://atomo-lang.org/ http://atomo-lang.org/ ) to the Rubinius VM, dubbed Quanto for now. It's similar to Fancy (though t
by vito 16y ago
I've been working on a port of Atomo (http://atomo-lang.org/ http://atomo-lang.org/ ) to the Rubinius VM, dubbed Quanto for now. It's similar to Fancy (though they were both designed/developed separately), but one of the main differences is that it has macros (and pattern-matching everywhere).
Example code: http://toogeneric.com/dump/pretty.atomo.html http://toogeneric.com/dump/pretty.atomo.html
"data", "class", "module", "=", and ":=" are all Lisp-style macros. It doesn't have Lisp syntax, but it's very close to it conceptually - in fact Atomo has Lisp's condition system, and a similar string formatting system, and dynamic environment. All of which I plan to port. Fun times ahead!
- riffraff 16y agointeresting, how do you model multiple dispatch in an efficient way over a vm that (I believe) wasn't designed for it?
- vito 16y agoVia pattern-matching at the moment: X foo: Y := ... X foo: Z := ... Both of these are inserted on X, which is used as `self` in the method body (so instance variables, etc. work as expected too). It's one method, `foo:`, which pattern-matches on its arguments to determine which branch to evaluate.
- riffraff 16y agoI see, but does this play well with the jit? What I mean is: wouldn't multimethods with many variants cause exponentially bigger thunks to inline, thus causing the JIT to not perform inlining at all? Thanks for your answer anyway, it looks like a really fun project.
- evanphx 16y agoLooking at the bytecode, the JIT handles it fine. atomo pattern matching is the equivalent of using a case;when in the body. And because it's scoped to a certain class and name, I doubt it would have the overflow problem that lisp multimethods have, where you only have the name to bind functionality to.