>>107568710
Out of all the languages that have multiple dispatch, I think Julia makes the best use of this feature, because:
- All functions are generic by default (so you can't opt out of it), and
- as a result, they got community-wide buy in on multiple dispatch, so it's used pervasively.
One small example of how to design a library using multiple dispatch is Nomnoml.jl.
https://github.com/MichaelHatherly/NomnomlJS.jl
In Julia, Base.read is a generic function with many specialized methods. (They use the same function/method terminology as CL's generics.) Here are a few basic examples.
# lang: julia
# Load the contents of a file into a Vector{UInt8}.
# Base.read(AbstractString)
read("file.txt")
Comment too long. Click here to view the full text.