3 ms·
I love clojure, let me make this clear. But there are certain aspects of the language that don't apply if you are writing a VM from scratch in RPython. If I cou
by _halgari 12y ago
I love clojure, let me make this clear. But there are certain aspects of the language that don't apply if you are writing a VM from scratch in RPython. If I could make multimethods dispatching on types as fast as protocols, what is the point of protocols?
A great example of this is the (fn [& args]) bit. In Clojure, variadic parameters are passed in as a ISeq. In Pixie they are a vector (or an immutable array actually). This allowed me to tune the JIT quite a bit to allow it to remove the allocation of "args" completely. As well as allow for things like unrolling a reduce over the args. This stuff would have been much harder if the arguments were passed in as an ISeq.
This is the whole reason why Pixie exists, instead of something like "clojure-on-rpython". Compatibility means constraining the feature set. And that's not something I want to do yet.
- emidln 12y agoIt might be interesting down the line to see if I couldn't target pixie using something like cljx (or actual feature expressions if they ever land in a mainline clojure release). This wouldn't necessarily require any effort on the part of my target, but still allow portability when it makes sense.
- carry_bit 12y agoOne advantage of having protocols in addition to multimethods is that you need to implement all methods in a protocol. This eases documentation, and is useful for methods that are fundamentally tied together.