When calling a multi method with the wrong number of arguments, the error message could be better.

Description

It is an implementation detail that multi methods are implemented via anonymous functions. I would expect the error message to at least contain the name of the function that failed, in this case it should have been something like

Several approaches can be taken here:

The first (and simplest) is to change the definition of defmethod so that the anonymous function gets a name.
This leads to an error message like:

In addition to this, one could modify Compiler.java to look for the calls to "addMethod"

which would give us error messages like

Environment

None

Activity

Show:
Alex Miller
November 9, 2017, 3:19 PM

Interestingly, it is actually possible to give defmethods names that get included in their class names. The arglist for defmethod is: ([multifn dispatch-val & fn-tail]) where fn-tail is the tail arguments as passed to fn, which includes an optional name.

So you can do this:

Note the HI in the class name. This doesn't address everything above but it is a helpful debugging trick.

Assignee

Unassigned

Reporter

Erik Assum

Labels

Approval

Triaged

Patch

None

Priority

Major
Configure