What is the right approach if I want (1) to use an inner constructor, which 
does some modification/normalization to the arguments, and (2) I want 
proper type parameter deduction from the arguments? Do I need to write a 
separate function or something?

I'm not even sure what's going on here (i.e., why it doesn't work with the 
inner constructor) – or how I could make it work with the outer constructor…

immutable A{N}

    x::NTuple{N, Int}

    y::Int

    A(x, y) = new(x, y + 1)

end


#a = A((1, 2), 3)       # Doesn't work

a = A{2}((1, 2), 3)     # Works (w/cumbersome param)

println(a)


abstract C


immutable B{N} 

    x::NTuple{N, Int}

    y::Int

end


#B(x, y) = B(x, y + 1)  # Stack overflow...

b = B((1, 2), 3)        # Works (w/wrong answer)

println(b)

What am I doing wrong?

Reply via email to