O'Reilly logo

Mastering Julia by Malcolm Sherrington

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required