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

This is a nice example @Elrod. This is one of the situations where it’d be quite handy to be able to make Foo{T} <: T. The other ones I’m aware of off the top of my head are

  • Symbolic types: when making a symbolic programming system that models julia code, it’d be really nice if you could have say Symbolic{Integer} <: Integer and Symbolic{DenseArray} <: DenseArray.
  • Autodiff: in automatic differentiation via operator overloading, you want a Dual{T} <: T so that you make sure you go down the right code-pathways for e.g. Real versus Complex primals.

A trait based approach would be quite nice for this.

6 Likes