Why it works
We have a different implementation for uni-variate and multi-variate functions. This is confusing. We should probably be able to opt-in to the multivariate implementation even for N = 1.
Edit: I’ve opened an issue Univariate user-defined functions with the multivariate signature · Issue #2534 · jump-dev/MathOptInterface.jl · GitHub
we shouldn’t even be able to pass two arguments
This is just a regular Julia thing. These two are the same:
foo(x, y) = x[1] + x[2]
foo(x...) = x[1] + x[2]
Although the x... doesn’t give as nice an error if you call it with the wrong number of arguments.