OOP in Julia, inherit from parametric composite type

There are two issues here:

  1. allowing the compiler to generate efficient code,
  2. reusing code when extending behavior.

Regarding (1), don’t worry about it too much. The first version of getv1 will compile for concrete types, and will be efficient. It should not be necessary to document return types, the compiler will figure it out (in general, methods should just be type-stable.

Regarding (2), see the discussion here.

1 Like