Although instructive, that example is almost identical to the corresponding
doc section
(http://julia.readthedocs.org/en/latest/manual/methods/#parametric-methods)
so I doubt I could add much value other than a link to the docs ;)
// T
On Thursday, May 15, 2014 11:39:53 AM UTC+2, Mauro wrote:
>
> This is a good summary, cheers.
>
> Maybe you include an example of a parametric function as well as was
> discussed in this tread earlier? For instance:
>
> julia> foofoo{T<:Real}(x::T,y::T) = x
> foofoo (generic function with 1 method)
>
> julia> barbar(x::Real,y::Real) = x
> barbar (generic function with 1 method)
>
> julia> foofoo(3//2,2)
> ERROR: no method foofoo(Rational{Int64}, Int64)
>
> julia> barbar(3//2,2)
> 3//2
>
> Then, for reference, I've been musing about this a few month ago too:
> https://groups.google.com/d/msg/julia-dev/pGvM_QVmjX4/V6OdzhwoIykJ
> and here it get discussed a bit too:
> https://github.com/JuliaLang/julia/issues/1090
>
>
> On Thu, 2014-05-15 at 09:59, [email protected] <javascript:> wrote:
> >>
> >> it silently uses :: in a different sense than anywhere else in the
> language
> >
> >
> > I started writing a reply here, but realized it would be more
> instructive
> > to have it as an IJulia notebook, where we can actually inspect the
> values
> > of various statements along the way - take a look here
> > instead:
> http://nbviewer.ipython.org/github/tlycken/IJulia-Notebooks/blob/master/A%20more%20thorough%20look%20at%20Julia's%20%22double%20colon%22%20syntax.ipynb
>
> >
> > I hope it makes things a little clearer. I tried to base it on the
> relevant
> > section on `::` in the manual
> > (http://docs.julialang.org/en/latest/manual/types/#type-declarations)
> and
> > expand it with more examples etc, so I hope it's possible to see the
> > connections.
> >
> > // T
>