Skip to content

Conversation

@jmh530
Copy link
Contributor

@jmh530 jmh530 commented Jul 10, 2022

It can be useful to work with dates as year-months, dropping the day.

@9il
Copy link
Member

9il commented Jul 11, 2022

Please make it a non-template type. The generic YearMonth is a complication. We use a private YearMonth type and if it isn't generic we can replace it with the current one. Nongeneric YearMonth types are also required for de/serialization support and better API reflection.

@jmh530
Copy link
Contributor Author

jmh530 commented Jul 11, 2022

@9il Does everything need to be non-generic? For instance, can I make the day function generic (and any function calling day, by implication)?

@jmh530
Copy link
Contributor Author

jmh530 commented Jul 11, 2022

@9il Nevermind, I can include it AssumePeriod as a function parameter for day instead of as a template parameter.

@jmh530
Copy link
Contributor Author

jmh530 commented Jul 11, 2022

@9il I'm running into issues with it a circular instantiation of _endDict, which seems to be caused by the code below. If I comment out _dictYM and where it is used, then it compiles without error. I can't seem to trace down where the issue is, if you have any idea.

 static immutable _dictYM = () { YearMonth[Date._endDict - Date._startDict] dict; foreach (uint i; 0 .. dict.length) dict[i] = Date(i + Date._startDict).yearMonthImpl; return dict; }();
@jmh530
Copy link
Contributor Author

jmh530 commented Jul 11, 2022

@9il Fixed issue by removing second call to _endDict. Not really sure though why it was causing issues. I even tried filling _endDict with the julian date and it still caused it.

@9il 9il merged commit 1dd5b1a into libmir:master Jul 11, 2022
@jmh530 jmh530 deleted the add-yearmonth branch July 26, 2022 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants