On Friday, January 22, 2016 at 1:03:05 AM UTC-5, Mauro wrote:
>
> you mean why the second errors:
>
> julia> Irrational
> Irrational{sym}
>
> julia> Irrational{sym}
> ERROR: UndefVarError: sym not defined
>
> ? Irrational is all that is needed. Would this help:
>
I guess my point is, why does subtypes display something that is not a
valid type?
It seems to be more of a display problem, in that if you use the type
returned from subtypes directly, it is fine.
Same thing with the returned Rational{T<:Integer}, where if you try to use
that, you get an error about the <:
What would be the correct text forms that would create the same types as
returned by subtypes(Real)?
Thanks, Scott
> julia> Irrational{TypeVar(:T)}
> Irrational{T}
>
> On Thu, 2016-01-21 at 19:21, Scott Jones <[email protected]
> <javascript:>> wrote:
> > I ran across something strange today, with some of the test code, that
> used
> > something like:
> > for x in [subtypes(Real) ; subtypes(Complex)]
> > ...
> > end
> >
> > The issue is that subtypes(Real) returns:
> >
> > *julia> **subtypes(Real)*
> >
> > *4-element Array{Any,1}:*
> >
> > * AbstractFloat *
> >
> > * Integer *
> >
> > * Irrational{sym} *
> >
> > * Rational{T<:Integer}*
> >
> > If instead of having subtypes(Real), I try to put the types in directly,
> it
> > won't accept either Irrational{sym} or Rational{T<:Integer}.
> > Is there a correct way to represent those? Should Irrational{sym} be
> > something like Irrational{::Symbol}?
> > Is this a bug in subtypes?
> >
> > Thanks, Scott
>