[squeak-dev] Status of date problem

Chris Muller asqueaker at gmail.com
Sat Mar 19 03:40:03 UTC 2016


> Since “utcOffset:" appears to do the right thing I’d actually prefer it to the “nowAtOffset:” you just introduced. E.g. to get the current time in LA you could simply use
>
> DateAndTime now utcOffset: -7 hours
>
> No need for a new message. Arguably this is what “offset:” should do, and it would if the implementation was utc-based (as is David’s) rather than local-time based.

I wish to keep #nowWithOffset:.  DateAndTime's are "value" objects --
like Points and Fractions.  I never want to write code that sets any
state on existing DateAndTime objects, not even their #offset.

Value objects are only ever created, and then their state never change
in 99% of cases.  Magma treats DateAndTimes as immutable in the
database for performance -- it doesn't bother to check if they
changed.

Semantically, #utcOffset: doesn't mean anything to me.  What is a "UTC
offset?"   #nowWithOffset: sorts in the list next to #now, and makes
it abundantly clear to users what use-case it handles.  I wish to keep
it.

Best,
  Chris


More information about the Squeak-dev mailing list