|
|
|
|
|
by shepik
2071 days ago
|
|
The deal with multiple dispatch, as I understand it, is that instead of obj->somemethod, you define function named somemethod, which is defined for obj.
Maybe some other code calls it. You can then define somemethod for other data types, without touching the original definition, and that makes your new definition available to the other code that used the original somemethod.
It is a unique feature of Julia (at least unique in a sense that it is absent from mainstream languages) |
|
function somemethod(x::Int, y::Int)
function somemethod(x::Int, y::Float64)
function somemethod(x::Float64, y::Float64)
Multiple dispatch is available at least in Common LISP, though I guess that's not considered particularly mainstream.