nolta/Calendar.jl

Make CalendarTime immutable

Closed this issue · 1 comments

This issue came up here: JuliaStats/TimeSeries.jl#17

I would do a pull request but not sure how much this disrupts the package. As far as I can see it involves changing type to immutable and removing the bang family of methods.

#change 
immutable CalendarTime

#remove
 # mutate fields
        year!,
        month!,
        week!,
        dayofyear!,
        day!,
        hour!,
        hour12!,
        minute!,
        second!,
        tz!,

#remove
    function $(symbol(string(f,'!')))(t::CalendarTime, val::Integer)
             cal = _get_cal(t.tz)
             ICU.setMillis(cal, t.millis)
             ICU.set(cal, $k, val - $o)
             t.millis = ICU.getMillis(cal)
             t
         end

Of course this is a major decision for the package.

Ok, the ! functions are now deprecated.