Is Julia's way of OOP superior to C++/Python? Why Julia doesn't use class-based OOP?

I’m coming late to this discussion and I can’t claim to have read all the posts carefully so forgive me if I reiterate something already discussed. One of the central differences between the “methods defined within classes” style of OOP and the Julia approach of generic functions with multiple dispatch is, obviously, the ability to dispatch on the types of more than one argument. The “poster boy” application for why this is a good idea is numerical linear algebra. To achieve flexibility and efficiency in numerical linear algebra you need to be able to examine and exploit the types of all the arguments.

Over the past 30 years I have worked with many different linear algebra packages in Fortran, C, C++, and Python. I even had a hand in designing and writing the Matrix package for R. None of them come close to the coverage, flexibility, and efficiency of the LinearAlgebra standard library for Julia.

Of course, this isn’t an accident. Julia was designed for technical computing and the choice (and hideously efficient implementation) of multiple dispatch was intended for exactly these cases.

31 Likes