3 ms·
Via 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 in
by vito 16y ago
Via 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.