Multiple dispatch
A function is an object that maps a tuple of arguments to a return value. In a case where the arguments are not valid, the function should handle the situation cleanly by catching the error and handling it or throw an exception.
When a function is applied to its argument tuple, it selects the appropriate method and this process is called dispatch. In traditional object-oriented languages, a method is chosen based only on the object type and this paradigm is termed single dispatch. With Julia, the combination of all function arguments determines which method is chosen; this is the basis of multiple dispatch.
To the scientific programmer, all this seems very natural. It makes little sense in most circumstances for one argument to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access