[squeak-dev] Re: How to have a fast and usable Date? (was: new Bug in Locale)

David T. Lewis lewis at mail.msen.com
Thu Feb 2 21:01:18 UTC 2012


On Thu, Feb 02, 2012 at 02:50:56PM -0500, Yanni Chiu wrote:
> On 02/02/12 11:25 AM, Chris Muller wrote:
> >
> >Best to strip all Dates (NOT DateAndTimes) of their timezone.
> 
> IMHO, there are two different concepts getting mixed up.

Correct.

> 
> 1) There is a "date", which has a day, month and year (and calendar). If 
> you're modeling dates to be printed on a 12-month calendar that can be 
> used anywhere in the world, then this is the kind of date you want.
> 

Yes, I think that was more or less the original implementation in earlier
Squeak before Chronology was added.


> 2) There is the 24hr period (sometimes 23hr or 25hr) which corresponds 
> to that "date". This 24hr period is timezone dependent. If you're making 
> a scheduling application, then this is the kind of date you need.

Yes, and this is the meaning of "date" in more recent Squeak.

> 
> So, i agree: remove timezone from Date.

Date does not have a timezone. It has a start DateAndTime, which in
turn has an offset from UTC. Neither Date nor DateAndTime has a timezone.

> 
> >I propose Date's, by default, be created with the UTC offset, NOT the
> >local offset.
> 
> Disagree. The natural default for today, is the date in my local 
> timezone. Maybe #todayUTC should be introduced. Then why not add 
> #todayInTimezone: too. Hmm...timezones seem to be creeping back in.
>

+1

And more generally, don't change it at all unless we can clearly
state the (new?) meaning of "date" and write it down in a class
comment for all to see and understand. A "date" may mean very
different things in the context of different use cases, so if
there is an interest in making something with a different meaning,
it suggests that a different class should be invented. There is
also an ANSI Smalltalk definition to keep in mind here.

Dave

p.s. I just ran the unit tests for TimeZoneDatabase and see new
failures, but only when running on the standard interpreter. Did
we change something in the image in a Cog-dependent way? I'll track
it down as soon as I get some time but if someone can point me to
the answer I'd appreciate it.
 


More information about the Squeak-dev mailing list