3 ms·
The solution I've been playing with for $interp_thing (mostly in my head so far) is roughly the python version but with some type dispatch checking to pick the
by mst 6y ago
The solution I've been playing with for $interp_thing (mostly in my head so far) is roughly the python version but with some type dispatch checking to pick the "most specific" of the two - which is easy when one is a subclass of the other but gets gribbly in more complicated cases. I suspect ultimately it'll be a case of "run a multimethod style selection algorithm for 'most specific' and arbitrarily declare 'LHS wins'" but I've not got far enough to consider that remotely fully baked.
($interp_thing being a placeholder for something I'm experimenting with of late)
- xscott 6y agoYes, OO inheritance and subclassing complicates the multimethod selection algorithm, allowing for there to be ambiguity or ties. I don't use inheritance very often, so if it was my $interp_thing I would just leave it out. I don't remember the details very well, but "The Art of the Metaobject Protocol" is a book which goes into this topic. That's in the context of multimethods for Common Lisp, and I suspect they were very thorough and careful with the solution they used. https://en.wikipedia.org/wiki/The_Art_of_the_Metaobject_Protocol https://en.wikipedia.org/wiki/The_Art_of_the_Metaobject_Prot...