[squeak-dev] Fixes for Durations (week, hour, ...)

Chris Muller asqueaker at gmail.com
Mon Oct 29 19:38:43 UTC 2012


Thanks Torsten, I did see that discussion on Pharo and I was surprised
to see the #hour vs. #hours discrepency myself.  However, I'm curious
whether Brent had a specific reason for doing it that way.  We should
consider that the propsed change IS stripping away functionality.
What if I want to advance or retreat *in the direction of* by an
increment of one-hour units based on whether something is positive or
negative.  Before I could simply write one word, "hour" now with this
proposed change, I would have to write:

  factor positive
    ifTrue: [ 1 hour ]
    ifFalse: [ -1 hour ]

Worse, I have no way to implement the directional-increment myself.
If anything, I would rather *remove* the singulars altogether rather
than overload them.

The "arguments" in the Pharo discussion were exceptionally weak -- in
fact, almost non-existent.  "It does not make sense," is the only
thing I saw and even that was just the classic Pharo ideology of
putting form before function.

This is not urgent at all -- we should ask Brent the motive or at
least discuss it ourselves.  It definitely should not go into 4.4 at
this late stage.



On Mon, Oct 29, 2012 at 12:26 PM, Torsten Bergmann <astares at gmx.de> wrote:
> There was a discussion on Pharo list on methods like
>  hours vs. hour
>  minutes vs minute
>  ...
>
> with the agreement that it makes only sense to have
> the plural and singular forms the same.
>
> This allows more natural treating of durations and fix some
> issues so things like:
>
>   0.5 hour minutes
>
> or
>
>  (1/2) hour minutes
>
> return 30 correctly, etc.
>
>
> There are three Pharo issues ([2] [3] and [4]) for that.
>
> I reworked the changes and test cases also for Squeak
> (see attached changeset) since should help being compatible
> at this level.
>
> I can commit the changes to Squeak trunk - but at least
> maybe someone can shortly review them.
>
> Thx
> Torsten
>
>
> [1] http://lists.gforge.inria.fr/pipermail/pharo-project/2012-October/070509.html
> [2] https://code.google.com/p/pharo/issues/detail?id=6877
> [3] https://code.google.com/p/pharo/issues/detail?id=6876 (duplicate of 6877)
> [4] http://code.google.com/p/pharo/issues/detail?id=6886
>
>
>


More information about the Squeak-dev mailing list