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

Chris Cunningham cunningham.cb at gmail.com
Tue Sep 16 18:06:42 UTC 2014


On Tue, Sep 16, 2014 at 8:27 AM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

>
> On 15.09.2014, at 23:05, Chris Cunningham <cunningham.cb at gmail.com> wrote:
>
>
>
> 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.
>
>
> How about GenericDuration, to keep with the theme?
>
> That sounds resaonable.  I'll add it in in the next day or two (when I get
a couple of hours) and add comments as well - this class definitely
deserves it (and the other two should have comments as well).

- Bert -
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140916/e353c1c1/attachment.htm


More information about the Squeak-dev mailing list