What should the new method be, precisely? I tried colon(start::JDate, step::Real, stop::JDate) = JDate(colon(float64(start),step,float64(stop)) (I have conversion rules defined for the JDate to Float64 conversions), but I get several warning messages of the form:
Warning: New definition colon(JDate,Real,JDate) at <path>\types.jl:25 is ambiguous with: colon(T<:FloatingPoint,T<:FloatingPoint,T<:FloatingPoint) at range.jl:122. To fix, define colon(JDate,JDate,JDate) before the new definition. Then, when I test this, I still get a Array{Float64,1}. Thanks, Chris On Wednesday, May 13, 2015 at 12:05:19 PM UTC-4, Josh Langsfeld wrote: > > I believe you only need to add a method to Base.colon of the form > 'colon(start::JDate, step::Real, stop::JDate)' > > I just tested it and that was the only thing needed to make the the > [J1:s:J2] syntax work. > > On Wednesday, May 13, 2015 at 11:13:53 AM UTC-4, Chris wrote: >> >> I have a simple custom type called JDate: >> >> immutable JDate <: FloatingPoint >> >> t::Float64 >> >> end >> >> When I construct a range, e.g. [J1:s:J2], where J1::JDate, s::Real, >> J2::JDate, I'd like the result to be an Array{JDate,1}. What >> conversion/promotion rules are necessary to do this? >> >> Thanks in advance, >> Chris >> >