3 ms·
True, but in R (at least in S3) it's probably avoided by design because of default parameters. A short example: genericfun.type1 <- function(x, sub=1) x - su
by kkoncevicius 4y ago
True, but in R (at least in S3) it's probably avoided by design because of default parameters. A short example:
genericfun.type1 <- function(x, sub=1) x - sub
genericfun.type2 <- function(x, y) sum(x, y)
The single case can be differentiated:
genericfun(x)
But which function are we calling with:
genericfun(x, y)
I don't know about Julia and how it solves this. Maybe by not allowing to pass nameless optional arguments.
- disgruntledphd2 4y agoS4 can dispatch on multiple arguments, just like Julia (though it seems a lot more natural in Julia).