Julia: Day of week (Monday, Tuesday, ...) and Months might be Enum

Created on 3 Nov 2016  路  7Comments  路  Source: JuliaLang/julia

Following https://github.com/JuliaLang/julia/issues/19208

Day of week (Monday, Tuesday, ...) might be an Enum instead of an Int

See https://github.com/JuliaLang/julia/blob/30bf89f3d8e564b588b8e48993e92a551b384f2c/base/dates/query.jl#L30

So

const Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday = 1,2,3,4,5,6,7
const Mon,Tue,Wed,Thu,Fri,Sat,Sun = 1,2,3,4,5,6,7

could be replaced by

@enum(DayOfWeek, 
    Monday = 1,
    Tuesday,
    Wednesday,
    Thursday,
    Friday,
    Saturday,
    Sunday
)
Mon, Tue, Wed, Thu, Fri, Sat, Sun = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
dates

Most helpful comment

Months could also be an enum, though this might be a bit more of a breaking change.

All 7 comments

Months could also be an enum, though this might be a bit more of a breaking change.

I'm also for Months as Enum (see https://github.com/JuliaLang/julia/issues/19221 )

But this should probably be part of an other PR.

My opinion is also that we should also take care of performance benchmarking.

Is there any website which display such graph
like http://pandas.pydata.org/pandas-docs/vbench/vb_index_object.html ?

It will help to see performance regression.

PS: An other example of benchmark https://pv.github.io/numpy-bench/

I'll drop a breadcrumb here of some past benchmarks I did for Dates code. It obviously needs restructuring in order to get into BaseBenchmarks.jl, but might be a useful starting point if someone is up for it.

So there is no website to display historical values after each commit ?

So there is no website to display historical values after each commit ?

馃挴 this is what I've wanted for a rather long time.

Was this page helpful?
0 / 5 - 0 ratings