# Convert parametric-type on the run

**URL:** https://discourse.julialang.org/t/convert-parametric-type-on-the-run/12237
**Category:** General Usage
**Tags:** parametric-types
**Created:** [July 7, 2018, 8:43pm UTC](https://discourse.julialang.org/t/convert-parametric-type-on-the-run/12237 "2018-07-07T20:43:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lian\_Yunlong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lian_yunlong/32/14437_2.png) [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)
#### Post date: [July 7, 2018, 8:43pm UTC](https://discourse.julialang.org/t/convert-parametric-type-on-the-run/12237/1 "2018-07-07T20:43:22Z")

</div>

Hi everyone,  
I have the following definition of types:

```julia
mutable struct TYPEA{L,Tv<:Number}
    K::Array{Tv,8}
end
TYPEA1{Tv} = TYPEA{:A1,Tv}
TYPEA2{Tv} = TYPEA{:A2,Tv}

```

and I define a variable

```julia
a = TYPEA1{ComplexF64}(rand(ComplexF64,2,2,2,2,2,2,2,2))

```

I want to convert the type of `a` the other type `TYPEA2` and the variable `a` is abandoned thereafter. How can I do this without invoking a copy routine of `a.K` ? I don’t want to do that for efficiency reasons.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [July 7, 2018, 8:57pm UTC](https://discourse.julialang.org/t/convert-parametric-type-on-the-run/12237/2 "2018-07-07T20:57:45Z")

</div>

`TYPEA2{Complex64}(a.K)`?
