Re:Objects All the Way Down
by wtetzner on Friday November 27, 2015 @09:25AM
(#10637410)
You could specialize for primitives, e.g. under the hood generate complexExpression_int() and complexExpression_ref(). It wouldn't be too bad in terms of code size, because you only have to specialize primitives, and all reference types can share the same implementation.
[ Parent
| on HN ]
Re:Objects All the Way Down
by david-given on Friday November 27, 2015 @09:35AM
(#10637454)
Yes, that'd be the obvious thing to do, but I think right now it doesn't (I could be wrong; I haven't looked at the code for ages).
I did at one point try to specialise everything. The results were hilarious...
var a = cons(cons(cons(cons(empty, 1), 2), 3), 4);
As the left-hand-side of each cons was a slightly different type, it ended up generating four different versions of the cons function!