I suspect it's because Jacob originally wrote this code for 0.3 which provided much less permissive default constructors which only worked with exactly matching argument types.
On Wednesday, January 13, 2016, Tamas Papp <[email protected]> wrote: > Hi, > > I am reading the code of Base libraries to improve my understanding and > style. In base/dates/types.jl, I noticed > > for T in (:Year,:Month,:Week,:Day) > @eval immutable $T <: DatePeriod > value::Int64 > $T(v::Number) = new(v) > end > end > > which expands to code like > > immutable Year <: DatePeriod > value::Int64 > Year(v::Number) = new(v) > end > > I have a simple question: what is the reason for defining the inner > constructor? Wouldn't > > immutable Year <: DatePeriod > value::Int64 > end > > automatically define one, except for restricting to ::Number? If that is > the reason, I would like to understand why. > > Best, > > Tamas >
