This is now https://github.com/JuliaLang/julia/issues/14825
On Wednesday, January 27, 2016 at 4:52:00 PM UTC+1, Yichao Yu wrote:
>
> On Wed, Jan 27, 2016 at 10:35 AM, Tommy Hofmann > wrote:
> > I am trying to define two parametric types with circular dependency as
> >
On Thursday, January 28, 2016 at 12:23:34 PM UTC+1, Toivo Henningsson wrote:
>
> Yes, you're right! I guess that you would have to break the chain at some
> point with Any or similar, which doesn't feel quite satisfying. But maybe
> it's the best that you can do for now.
>
> In your code, when
In the meantime, you can relax the second type definition to
type t2{C, T} <: abstest
x::C
y::T
end
which will allow you to construct all the parametric types that you want, plus
some more. You could add a check in the t2 constructor to make sure that T
meets your expectations.
On Thursday, January 28, 2016 at 10:57:59 AM UTC+1, Toivo Henningsson wrote:
>
> In the meantime, you can relax the second type definition to
>
> type t2{C, T} <: abstest
> x::C
> y::T
> end
>
> which will allow you to construct all the parametric types that you want,
> plus some more. You
Yes, you're right! I guess that you would have to break the chain at some
point with Any or similar, which doesn't feel quite satisfying. But maybe
it's the best that you can do for now.
In your code, when you access fields that are not typed as strictly as you
want, at least you can put in a
Are circular type trees supposed to work?
We can't even join types:
*abstract A*
*abstract B*
*type D <: Union{A, B} # Fail*
*end*
*typealias D Union{A,B}*
*julia> **D <: Union{A,B}*
*true*
*;) thanks*
Whoops. Can I get editing permission for my own posts?
"even"
On Wed, Jan 27, 2016 at 8:43 PM, Bryan Rivera
wrote:
> Are circular type trees supposed to work?
>
> We can't even join types:
>
> *abstract A*
>
> *abstract B*
>
> *type D <: Union{A, B} # Fail*
>
> *end*
>
*typealias D Union{A,B}*
*julia> **D <: Union{A,B}*
*true*
*Is this what you meant?*
*So if the example code is a bug, does this mean Julia should have a
recursive type tree?*
On Wed, Jan 27, 2016 at 10:35 AM, Tommy Hofmann wrote:
> I am trying to define two parametric types with circular dependency as
> follows.
>
> abstract abstest
>
> type t1{A <: abstest, B}
> x::A
> y::B
> end
>
> type t2{C, B} <: abstest
> x::C
> y::t1{t2{C, B}, B}
> end
11 matches
Mail list logo