On 19.09.2014, at 14:16, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Part of that is in https://pharo.fogbugz.com/f/cases/13229/Year-arithmetic-broken
Furthermore, I am not so sure all this is a good idea, year/month durations are not constants and are dealt with differently in many context (say the financial world).
January 30 + 1 month ? January 31 + 1 month ?
Issue 13299 doesnât change that (I donât know about the other change). There is still only the Month object which knows its number of days, so a month will always be used in a defined context.
Februari 29 2004 + 1 year ?
This one is hard and the change in issue 13299 does indeed make the assumption that February 29 2004 + 1 year = February 28 2005. One might argue that is should be March 1. But: that is also the assumption the *current* implementation makes, so no change there.
And given all sorts of cleverness, will basic math rules still work ?
A +B = B + A A + B = C => C - B = A
On 19 Sep 2014, at 13:54, Sean P. DeNigris <sean@clipperadams.com> wrote:
From http://forum.world.st/Next-version-of-Date-DateAndTime-and-Duration-API-upda... :
Now in the InBox: KernelTests-cbc.278.mcz Kernel-cbc.871.mcz The tests add in test for expected Duration addition and subtraction from each other, including the new GenericMonth and GenericYear, and the very new GenericDuration. It also adds a few more tests for LeapYear tests with adding years to them.
The test are still based on what it currently does, with the exceptions listed previously (I haven't really changed any to expect failures, as has been suggested - that will come shortly. For now, I want to try to cause little to no changes o expected behavior first - just new behavior for now).
Kernel adds the GenericDuration, and handles adding and subtracting GenericMonth, GenericYear, and GenericDurations togeher in a rational way. This involves turning + and - in Durations into a double-dispatch so that it will work.
There are no comments yet in these classes - they will be there before the weekend is over at the latest.
Any comments are more than welcome.
-cbc
----- Cheers, Sean -- View this message in context: http://forum.world.st/Interesting-Date-Time-Thread-on-Squeak-Dev-tp4778652p4... Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.