Woops, example 2 should be:
type Root{T}
...
end
On Fri, Jan 30, 2015 at 4:53 PM, James Crist <[email protected]> wrote:
> The problem:
>
> I have 2 types. They have the same internal structure, and both can be
> thought of as subtypes of an abstract root.
>
> abstract Root
>
> type Foo <: Root
> ...
> end
>
> type Bar <: Root
> ...
> end
>
> Because they have the same internal structure, I could equally define a
> parametric type `Root`, and typealias `Foo` and `Bar`:
>
> type Root
> ...
> end
> typealias Foo Root{:Foo}
> typealias Bar Root{:Bar}
>
> The Question:
>
> Given a collection of objects of these types (say a vector), where both
> Foo and Bar will be present, which way is more performant/Julian?
> Basically, is it better to have a collection of an abstract type (option
> 1), or of a parametric type with the parameters yet to be specified (option
> 2)?
>