I don’t know what a “traditional object hierarchy” is. Julia has single-ancestor subtypes, where the leafs are concrete and the rest is abstract types. These are mostly used for governing dispatch. Composition is recommended for what some OO languages solve with inheritance. See
I am a relatively newbie and I am wondering what is the most appropriate Julian way to reuse the code.
I don’t want to trigger discussions on topics already discussed a million times. This post simply aims to lay down a clear list of rules to be followed to write good Julia code, and pose a couple of questions.
Let’s start with an example: I have a type Person
mutable struct Person <: AbstractPerson
name::String
age::Int
end
and a lot (hundreds) of methods dealing with it. Now I wa…
I am using the Julia type system seriously for the first time and have just learned that it doesn’t support inheritance from non-abstract types nor multiple inheritance. This statement applies to Julia v0.5.
Could you please explain how one can workaround these limitations, specifically:
How you develop code with inheritance from abstract types only? Does it cover all possible use cases?
Is there any workaround for the lack of multiple inheritance?
Hey,
so this might be a rather vague question but anyway here it is. I am really having a hard time getting to grasp with OOP in Julia. I am developing a package for specific clinical trial designs and these designs can essentially be represented as a tuple of vectors. Trying to be thorough I implement them as parametric composite types. E.g. the base design could be
type DesignA{T1, T2}
v1::Vector{T1}
v2::Vector{T2}
end
Now another design could be just like DesignA but with additional pa…
and similar topics.
Also, I would not worry about representation in memory etc, other than what is described in the
https://docs.julialang.org/en/stable/manual/performance-tips/
2 Likes