The basic question is what the methods #hours #seconds #days in Class Duration should answer.
The bug report says:
1. self assert: 2 days hours = 48
it will fail
It’s a bug because of what is said in the comment. But please don’t even think in fixing it by changing the comment. Even a toddler would expect to see 48 hours in a duration of two days.
The poster proposes to ignore the ANSI standard and fix that to make a Duration answer its number of hours it spans over instead of the number of hours of the last unfinished day it spans over. The discussion then concentrates on whether the ANSI standard should be taken as sacred or if it was better to make things more intuitive. I’d argue it is intuitive as it is.
In fact I’d say this is not a bug at all. It’s absolutely consistent behaviour with Time, DateAndTime and so on.
Let’s say you ask somebody for the time. The natural answer is “It’s 9 hours and 23 minutes”. And this means the time consists of nine hours and 23 minutes rather than 563 minutes. You may want to know how many minutes have passed since midnight, but that’s not the “natural” way of thinking in terms of time.
If you ask somebody how long it took them to write a new iPhone application, they’d say “2 days, 8 hours and 7 minutes”. So the minutes part is 7, not (2*24*60)+(8*60)+7= 3367. You may want to ask: “and how much would that be in minutes?”. But that’s a completely different question.
So I guess the ANSI standard wasn’t so stupid at all, because the idea of the Smalltalk class library was to make the handling of things as natural as possible. There are or should be methods to answer more specific questions like “How many of unit x would that be”, like #asMinutes or #totalMinutes or the like, but I am quite comfortable with the way of thinking in the original design.