Fixes for Durations (week, hour, ...)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fixes for Durations (week, hour, ...)

Torsten Bergmann
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



FixDurat.cs (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fixes for Durations (week, hour, ...)

Chris Muller-3
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 <[hidden email]> 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
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixes for Durations (week, hour, ...)

Colin Putney-3


On Mon, Oct 29, 2012 at 12:38 PM, Chris Muller <[hidden email]> wrote:
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.

Agreed. Perhaps for 4.5, after some discussion.

Colin