As Jutho mentioned, a parametric type without a type parameter is just
another abstract type so I don't think there would be any difference in
performance.
But if Foo and Bar have the same internal structure, are they really
different types at all? You could always do a manual type dispatch
James, in case you haven't seen it, this is treated _extensively_ in the FAQ.
Make a nice cup of tea and pull up a comfy chair before you start reading :-).
--Tim
On Sunday, February 01, 2015 01:16:19 AM Jutho wrote:
As long as not all parameters of a parametric concrete type are fully
As long as not all parameters of a parametric concrete type are fully
specified, the type is treated as abstract. So in both cases your collection
would be of abstract elements and they would not be stored packed in memory. I
don't think what you are requesting is possible, but I might be
Thanks, that's kind of what I expected.
@Tim:
I found some stuff in there (and in the very helpful Types section), but
never saw explicitly whether a collection of unparametrized parametric type
offered any additional benefit to the compiler than one of just abstract
type. (i.e. Rational[] vs
Anyone have any thoughts on this? What I'm trying to figure out is a way to
dispatch on different elements all in the same collection, without
declaring the collection to be of abstract type. Meaning `func(a::Foo)` and
`func(a::Bar)` should be different, even though `Bar` and `Foo` have the
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
Woops, example 2 should be:
type Root{T}
...
end
On Fri, Jan 30, 2015 at 4:53 PM, James Crist crist...@umn.edu 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