No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a new
type `B{T}` is created for each `T`).  So you shouldn't lose performance
because of this.

Cheers,
   Kevin

On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander <uvapa...@gmail.com>
wrote:

> Let's say I have the following types:
>
> abstract ABC
>
> type A <: ABC
>         a::Float64
> end
>
> type B{T <: ABC}
>         a::T
> end
>
> In some cases, I need for type "B" to be incompletely initialized so that
> I can define its parameter "a" later.  I've found out that you can do
> something like this:
>
> type B{T <: ABC}
>         a::T
>
>         call(::Type{B}) = new{ABC}()
> end
>
> which then allows this:
>
> julia> myB = B()
> B{ABC}(#undef)
>
> My question is, I'm assuming you lose any of the performance gain by using
> the parametric type in this case because you are still using the abstract
> type "ABC" for the parameter "a" (even if you define it later with a
> concrete "A").   Is there a better way to do this?
>
> Thanks!
>
> Chris
>

Reply via email to