I am facing a problem for which I am not 100% sure of the pros and cons of two different solutions. Imagine that I have an abstract type:
abstract type A end
and various concrete types:
struct T1 <: A end struct T2 <: A end # ...
Some of these types have a property, let’s say
iscool(::T1) = true and
iscool(::T2) = false. I wonder what are the pros and cons of specializing a method
iscool for each type versus adding a new level of inheritance:
abstract type A end abstract type Acool <: A end struct T1 <: Acool end struct T2 <: A end
At the caller site, I would be using either one of the following to determine the coolness of the object:
obj isa Acool
Could you please share your suggestions for choosing one solution over the other or any other better solution that you know in Julia?