[squeak-dev] Status of date problem

Bert Freudenberg bert at freudenbergs.de
Sat Mar 19 07:59:00 UTC 2016


On 19.03.2016, at 04:40, Chris Muller <asqueaker at gmail.com> wrote:

>> 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.

#offset: does return a new instance.

> 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.

Yep. Same in general.

> Semantically, #utcOffset: doesn't mean anything to me.  What is a "UTC
> offset?"   

Agreed.

> #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.

How about one character more? A space?

... now withOffset: ...

I think composability is preferable to an explosion of one-off specialized methods. I'd rather deprecate both #offset: and #utcOffset: and start doing the Right Thing. 

- Bert -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6112 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160319/8b85ac2a/smime.bin


More information about the Squeak-dev mailing list