This is by far one of the more confusing parts of core Julia syntax. I
apologize for not having come up with anything clearer :-\


On Tue, Apr 22, 2014 at 10:36 AM, Jameson Nash <[email protected]> wrote:

> Even more confusing, you can define a parametric inner constructor:
> Point{S}(x::S, y::S) = ..., which defines methods for Point{T}
>
> On Tue, Apr 22, 2014 at 10:31 AM, Matt Bauman <[email protected]> wrote:
> > On Tuesday, April 22, 2014 12:08:01 AM UTC-4, Kevin Squire wrote:
> >>
> >> … until I realized that T in the first set of braces is a function type
> >> parameter (i.e., specializing the function), and the second is a
> >> specialization of the constructed type.
> >
> >
> > Yes, exactly.  I think it's that the notation seemed backwards to me.
>  For
> > the inner constructor you write Point(x::T, y::T) = ..., but it defines
> > methods for Point{T}. And for parametric functions, you write
> > Point{T<:Real}(x::T, y::T) = ..., and it defines methods for Point!
>

Reply via email to