[squeak-dev] Class comment for Date mentions #localizedDates

Chris Muller asqueaker at gmail.com
Sun Jun 26 00:34:02 UTC 2016


Hi Dave, Dates created as positions by default is the definitely the
correct behavior.  The original Date implementation inherited the
abstraction from Timespan of a custom duration starting at a
particular DateAndTime.  While that is a fine for abstract Timespans,
it turned out to be a bad idea for Dates, since the vast majority of
the use of Dates are as positions, not spans.

Check out the discussion surrounding Berts recent clarification of the
implementation, where the timezone for Dates-as-positions is now set
to nil, so the "localized" or "globalized" nomenclature can be removed
from the comment.

 - Chris


On Thu, Jun 23, 2016 at 8:05 AM, David T. Lewis <lewis at mail.msen.com> wrote:
> The class comment says:
>
>   Instances of Date are Timespans with duration of 1 day.
>
>   Their default creation assumes a start of midnight of UTC to provide the fast, globalized Dates out of the box.  The legacy behavior that creates Timezone-sensitive Dates can be used by sending #localizedDates.
>
>
> I no longer see #localizedDates in the image, so I think the comment needs an update.
>
>
> For reference, and earlier version of the class comment said this:
>
>   Instances of Date are Timespans with duration of 1 day.
>   Their default creation assumes a start of midnight in the local time zone.
>
>
> I am not sure what the comment should say, but I would be happy if it could
> better convey the intended meaning of "Date" in addition to the explanation
> about creating instances relative to UTC versus local time zone.
>
> My expectation would be that a Date is a Timespan with a start value set to
> midnight in some time zone. The start value is a DateAndTime, and the offset
> instance variable of that DateAndTime would reflect that time zone.
>
> I would therefore expect that a "globalized" Date is a special case of a Date
> that was created with the start of the Timespan at midnight UTC, regardless
> of the current local time zone. A "globalized" Date is no different from any
> other Date, it is simply a Date that was created with time zone UTC.
>
> Is that right?
>
> Dave
>
>


More information about the Squeak-dev mailing list