Machine Lines

Multiple Dispatch

Raven supports method overloading, so you can define a function multiple times for different kinds of inputs. fn describe(x: Integer) { "a whole number" } fn describe(x: Float64) { "a decimal number" } test describe(1) == "a whole number" test describe(1.5) == "a decimal number" describe looks from the outside like a single function. But when you call it, it’ll switch to the right implementation based on the inputs you provided.
This post is for my sponsors. If you're already signed up, log in for access.