[squeak-dev] Could we have 1 api that work across all of the datish classes?

Chris Cunningham cunningham.cb at gmail.com
Mon Sep 15 21:05:38 UTC 2014


On Mon, Sep 15, 2014 at 9:51 AM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

>
> On 15.09.2014, at 18:10, Chris Cunningham <cunningham.cb at gmail.com> wrote:
>
> On Sun, Sep 14, 2014 at 10:03 AM, Bert Freudenberg <bert at freudenbergs.de>
> wrote:
>
>>
>> On 14.09.2014, at 07:46, Chris Cunningham <cunningham.cb at gmail.com>
>> wrote:
>>
>> This allows the introduction of GenericMonth and GenericYear, so that we
>> CAN do things like
>>    DateAndTime now + 4 months
>> This 'GenericMonth' simple holds the number of months that you want to
>> add (or subtract), and then does the appropriate addition of days based on
>> the DateAndTime.  It handles different sizes of months, and leap years,
>> just fine.  SImilarly for GenericYear.
>>
>>
>> This sounds surprisingly reasonable to me ;-)
>>
>> I love using Squeak interactively, and these messages appear to do "what
>> I'd expect".
>>
>> The only objection I'd have would be that it's not general enough: if you
>> rolled GenericMonth and GenericYear into one and added in a regular
>> duration, we could get something reasonable out of an expression like (1
>> year + 1 month + 1 week + 1 day).
>>
>
> That would be neat, but not straight-forward.  For instance, 1 month + 1
> day is no necessarily the same as 1 day + 1 month!  At least, not with the
> expectations given before.  Specifically:
>
> August 30th + 1 month + 1 day = October 1st.
> August 30th + 1 day + 1 month = September 30th.
>
> Similarly, I think you can run into trouble with ordering of years and
> months (around Leap years, mainly), but I haven't worked that out yet.
>
> Maybe a third type of duration - that can take a sequence of additive
> (subtractive) durations, and apply them together later.
>
>
> You're right, that's how it should work.
>
> Do you have a proposal for what to call this thing?  I'd be likely to call
it something like 'SequenceOfDurations'.  Which I'm not really fond of.
-cbc

> But maybe I'm missing a point - what would you want to get our of (1 year
> + 1 month + 1 week + 1 day)?  What questions would you ask of such a thing?
>  Remember, once you get into months and years, they are unspecific until
> given the context of a real month and or year.  A month is anywhere from 28
> to 31 days (and possibly an extra second or similar); a year is 365 or 366
> days.
>
>
> I guess it would just be for aesthetic reasons, ensuring that (a + b) + c
>  = a + (b + c).
>
> - Bert -
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140915/51ca517d/attachment.htm


More information about the Squeak-dev mailing list