Thanks, that makes more sense! In my case I wanted `Name1{S} <: S` but 
neither `Name1 <: S` or `S <: Name1` make sense.


On Saturday, April 2, 2016 at 12:47:07 PM UTC-7, Erik Schnetter wrote:
>
> Julia's type hierarchies use single inheritance only. Thus inheritance 
> mechanisms that work fine in C++ can't always be made to work in 
> Julia. There are discussions on introducing concepts (traits), but 
> that's still in a prototype stage. (I'm using traits 
> <https://github.com/mauro3/Traits.jl> in a project of mine; this works 
> fine, only the error messages are sometimes confusing.) 
>
> If you have `Name1{S <: Name2} <: S`, and you need to stick with 
> single inheritance, then you essentially define both 
>
> `Name1{S} <: Name1 
> `Name1{S} <: S` 
>
> (here `Name1` is the abstract type that Julia introduces for every 
> parameterized type; `Name1` is different from `Name1{S}`). 
>
> Since Julia uses single inheritance, you also need to have either 
> `Name1 <: S` or `S <: Name1`. Both would be strange, since they would 
> introduce a relation between `Name1` and `S`, but you haven't 
> specified `S`. 
>
> -erik 
>
>
> On Sat, Apr 2, 2016 at 3:36 PM, Scott Lundberg <[email protected] 
> <javascript:>> wrote: 
> > Thanks Erik, though I am not quite clear how it would break things. 
> > 
> > As for the real goal: 
> > 
> > Name2 is also templated such as Name2{A} and Name2{B}. There are lots of 
> > methods that dispatch depending on Name2{A} or Name2{B}. 
> > 
> > I want to add a subtype of Name2 (which I call Name1) that still 
> correctly 
> > dispatches for those methods. Another way I would like to do it is: 
> > 
> > abstract Name1{Name2{T <: AvsB} <: Name2{T} 
> > 
> > but of course that also does not work. 
> > 
> > Thanks! 
> > 
> > On Saturday, April 2, 2016 at 11:55:47 AM UTC-7, Erik Schnetter wrote: 
> >> 
> >> If you define an abstract type `Name1{S}`, then Julia automatically 
> >> defines another abstract type `Name` with `Name1{S} <: Name`. 
> >> 
> >> This would break if you tried to insert `S` into the type hierarchy as 
> >> well. 
> >> 
> >> -erik 
> >> 
> >> On Sat, Apr 2, 2016 at 2:51 PM, Tomas Lycken <[email protected]> 
> wrote: 
> >> > If it's abstract, what is the purpose of the type parameter? In other 
> >> > words, 
> >> > what is the ultimate goal you're reaching for? 
> >> > 
> >> > //T 
> >> > 
> >> > On Saturday, April 2, 2016 at 3:17:34 AM UTC+2, Scott Lundberg wrote: 
> >> >> 
> >> >> You can define: 
> >> >> 
> >> >> abstract Name1{S <: Name2} <: Name3{S} 
> >> >> 
> >> >> but I want to define: 
> >> >> 
> >> >> abstract Name1{S <: Name2} <: S 
> >> >> 
> >> >> However the second line does not work. Is there some other way to 
> >> >> accomplish the same thing? Thanks! 
> >> 
> >> 
> >> 
> >> -- 
> >> Erik Schnetter <[email protected]> 
> >> http://www.perimeterinstitute.ca/personal/eschnetter/ 
>
>
>
> -- 
> Erik Schnetter <[email protected] <javascript:>> 
> http://www.perimeterinstitute.ca/personal/eschnetter/ 
>

Reply via email to