Subject: Re: [boost] [chrono/date] class names
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-05-11 14:05:23
Le 11/05/13 19:07, Howard Hinnant a écrit :
> On May 11, 2013, at 12:31 PM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:
>> I would like to fix the names of date classes for the different representations. I'm not saying that all the representations need to be provided for a first release. Here it is my proposal.
>> The following are unchecked and non contextual dates classes
>> * calendar_date: field based representation of year + month + day.
>> * serial_date: days based representation
>> * ordinal_date: field based representation of year + day_of_year
>> * week_date: field based representation of year + week + weekday
>> Checked dates classes names just add a checked_ prefix to the corresponding unchecked date classes.
>> * checked_calendar_date: field based representation of year + month + day.
>> * checked_serial_date: days based representation
>> * checked_ordinal_date: field based representation of year + day_of_year
>> * checked_week_date: field based representation of year + week + weekday
>> We can also have an alias date
>> template <typename Tag = serial, validity=validity::unchecked>
>> class date;
>> so that
>> date<calendar> ~ calendar_date
>> date<serial> ~ serial_date
>> date<> ~ serial_date
>> I'm, open of course, to other defaults for these parameters, if the idea of an alias is accepted.
>> For the time been a single contextual date class should be enough, as all the contextual information is relative to the year/month/day representation.
>> * contextual_date: field based representation of year + month + day + context-meta-data
>> Comments, critics and suggestions are welcome.
> Two questions:
> 1. Why are the checked-names longer/more-complex than the unchecked names? I would've thought we wanted the opposite.
Yes we wanted it, I forgot it for an instant. I'm open to change to
> 2. What is the difference between the checked serial_date and the unchecked serial_date? Just range checking? Do we really want to range check a serial_date? That will make day increment/decrement a lot more expensive percentage wise.
A checked serial date is serial date that checks the validity at
construction time, either from days or from an unchecked calendar_date.
So the check could be on calendar dates which is more expensive.
Are we in line here?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk