i’m not certain if this applies, but the default inner constructor changed
from strictly typed to accepting any. So:

Julia 0.2 behavior:

immutable Dual{T}
    x::T
    Dual(x::T) = new(x) # implicit
end
Dual{T}(x::T) = Dual{T}(x) # implicit

Julia 0.3 behavior:

immutable Dual{T}
    x::T
    Dual(x::Any) = new(convert(T,x)) # implicit
end

Dual{T}(x::T) = Dual{T}(x) # implicit

But that also just looks like may have been a bug in 0.2.
​


On Mon, Aug 4, 2014 at 2:45 AM, Philippe Maincon <[email protected]
> wrote:

> Hi there,
>
> I expect the code (yes, still playing around with automatic
> differentiation...)
>
> immutable Dual{T,ndim}
>
>       x  :: T
>
>       dx :: Array{T,ndim}
>
> end
>
>
> function di(a,s)
>
>       b    = zeros(s...)
>
>       return Dual(a,b)
>
>       #       return Dual(a,[a]) # works as expected
>
> end
>
>
> c = di(3.,(2,3))
>
> typeof(c)
>
> to print
>
> Dual{Float64,2}
>
> But in Julia 0.2 (I believe.  What I use for sure is Julia Studio 0.4.4 on
> a 64 bit Windows 7 PC) it returns
>
>
> Nothing (constructor with 1 method)
>
> which I find peeving.  Note the line I commented out: if I uncomment it
> and comment the preceding one, I get the expected behaviour.
>
> What did I miss?
>
> Philippe
>
>

Reply via email to