Since you replaced the inner constructor with an explicit one, you also
need to define an outer constructor.

On Fri, Oct 9, 2015 at 7:13 PM Jason Merrill <jwmerr...@gmail.com> wrote:

> I'm trying to make a wrapper around an NTuple that takes varargs, but I
> can't figure out what the constructor should look like. I thought the
> following would work, but it throws an error
>
> jwm@jason-2 ~/s/julia> julia
>                _
>    _       _ _(_)_     |  A fresh approach to technical computing
>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>    _ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.4.0 (2015-10-08 06:20 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/                   |  x86_64-apple-darwin13.4.0
>
> julia> immutable NTSeries{N, T}
>          coefficients::NTuple{N, T}
>
>          NTSeries(a...) = new(a)
>        end
>
> julia> NTSeries(1.0, 2.0)
> ERROR: MethodError: `convert` has no method matching convert(::Type{
> NTSeries{N,T}}, ::Float64, ::Float64)
> This may have arisen from a call to the constructor NTSeries{N,T}(...),
> since type constructors fall back to convert methods.
> Closest candidates are:
>   call{T}(::Type{T}, ::Any)
>   convert{T}(::Type{T}, ::T)
>  in call at essentials.jl:57
>
> Any pointers?
>

Reply via email to