Well, yes Please let me try again, may be I am a bit slow
when I do a b=range(...)
the type of a is well known
julia> b=range(1.0,stop=2.0, length=10)
1.0:0.1111111111111111:2.0
julia> typeof(b)
StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}
I pass this to gamma
. At the time I call the default constructor with b
as an argument the type is known. I do not see a reason why julia could not specialise the type based on the argument by default. Instead I apparently have to explicitely โallowโ (?)/ โforceโ (?) the type specialization by setting <:Any
as the parametric type known at construction time (or typing statically with the StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}
which is quite difficult to manually type correctly at first try in by hand :-).
Or to paraphrase:
The way everything else in julia appears to be designed is to specialize at runtime on the concrete types of the arguments given by compiling a specialized version for each combination of types of the actual arguments. Opposed to that the behaviour for constructors is apparently to throw the type information away instead by default, unless not explicitely requested
This appears to be a very strange decision, the behaviour of constructors is diametrically opposed compared to โnormalโ functions ?