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

David T. Lewis lewis at mail.msen.com
Tue Jun 28 04:03:35 UTC 2016


On Mon, Jun 27, 2016 at 12:41:28PM +0200, Bert Freudenberg wrote:
> On Mon, Jun 27, 2016 at 5:30 AM, David T. Lewis <lewis at mail.msen.com> wrote:
>
> > A bit off topic, but is is worth asking:
> > If we really want to model Date as a position on a continuum of date
> > values, and if we think that the implementation of Date as a kind of
> > Timespan is not right, then shouldn't we just consider going back to
> > the earlier (Squeak 3.6 and earlier) implementation of Date as a Magnitude,
> > rather than Date as a Timespan?
> >
>
> I think this is a very relevant question. We may have to distinguish a Day
> from a Date.

This seems like a useful distinction to me. The concepts are different, and
they deserve different representations.

To me as a native American English speaker, I would say that "Day" implies
duration, and "Date" implies magnitude. I would expect that the current
implementation of date as duration might map most directly to a Smalltalk
class named "Day". And the earlier Squeak implementation of date as a
magnitude would map directly to a Smalltalk class named "Date".

> IMHO a birthday is a perfect example. It's defined by a day+month+year. If
> I was traveling I would celebrate the birthday in local time, so the
> generic "birthday" needs to compare equal to all the local dates
> independent of time zone.
>
> This is how Dates worked before we made them Timespans (because they had no
> time, and hence no time zone). And this is also how they worked after I
> added the "nil" offset hack (which ignores the timezone). But it's a hack,
> not a good design. I'm not entirely sure what a good design would look like
> that also does not break old code.
>
> - Bert -

If we can assume that the current Squeak implementation of Date as
a duration makes sense for a class named "Day" and that the prior
implementation of Date as a magnitude makes sense for a class named
"Date", then a possible way forward would be (in someone's local image,
not yet in trunk):

- Rename class Date as Day
- Copy the Date tests to a new class for the Day tests.
- Make sure that the tests for Day are working.
- Load an old version of Date from the most recent Squeak version that had Date as a magnitude.
- Make the unit tests work for Date.

Dave



More information about the Squeak-dev mailing list