Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 4027 days ago | link | parent

               ,(or default-method
                  `(err "no matching method found for multimethod:" ',name)))
Is this deliberate? It seems to me that the optional default-method argument is a default expression that will be evaluated, but without access to the arguments to the function.

1 point by rntz 4027 days ago | link

I'm not sure exactly what you're getting at. Admittedly, what I did there is somewhat hackish (although my original method was worse). The default-method argument is just that: a default method which will be called (with the arguments to the multimethod) if no other method is found. But the expression that makes it up is only evaluated if necessary (lazily, in an 'or expression). So if it produces an error, then when that expression is evaluated, that is, if and only if we have failed to find a matching method, it produces an error; and since, in the macro itself, I know the name of the multimethod, I can substitute this into the default for 'default-method, and have nicer error messages.


1 point by almkglor 4027 days ago | link

Ah sorry, misread the code, forgot the 'apply bit around the form.