OK, this works:
immutable A{N}
x::NTuple{N, Int}
y::Int
A(x, y) = new(x, y + 1)
end
A{N}(x::NTuple{N, Int}, y::Int) = A{N}(x, y)
But why is this necessary? (Adding type decl. to the internal constructor
doesn't seem to do anything useful.) And why is it not necessary if I
I don't really know if this is a bug or if there is some good technical
reason for this.
What seems to happen is that the definition
A(x, y) = new(x, y + 1)
removes the default constructor. You can see this by typing A on the REPL
(or methods(A))
Am Dienstag, 26. August 2014 09:14:10 UTC+2
Hm, yes. Is this somehow related to the default constructor stuff added in
0.3 (linked to issues #4026 https://github.com/JuliaLang/julia/issues/4026
and #7071 https://github.com/JuliaLang/julia/issues/7071)? Not that I see
exactly how they'd be related, except that they're linked to the same
Magnus,
Please feel free to file a new issue. Even if it is intentional it might
have to be better documented.
Cheers,
Tobi
Am Dienstag, 26. August 2014 10:41:30 UTC+2 schrieb Magnus Lie Hetland:
Hm, yes. Is this somehow related to the default constructor stuff added in
0.3 (linked to
Done https://github.com/JuliaLang/julia/issues/8135.