Time>>#-

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

Time>>#-

Christoph Thiede

Hi, there.


Is there any reason why we don't have Time>>#-?


- anotherTime

    ^ (self to: anotherTime) duration


Best,

Christoph



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Time>>#-

David T. Lewis
On Thu, Aug 15, 2019 at 07:56:04PM +0000, Thiede, Christoph wrote:
> Hi, there.
>
>
> Is there any reason why we don't have Time>>#-?
>

Yes. Conceptually, it does not make sense because class Time does not
represent a magnitude. If you want to think of the time of day as a
magnitude, then class DateAndTime is probably what you want.

The class comment for Time explains:

  If you need a point in time on a particular day, use DateAndTime.
  If you need a duration of time, use Duration.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Time>>#-

marcel.taeumel
Also, your interpretation of #- as "to" would break with the existing "minus" in DateAndTime. :-)

If you want to add such an interface in your source code, I would suggest something like #--> to make the intention more clear. However, it is not of much use in the Chronology package in general. I think.

Best,
Marcel

Am 16.08.2019 06:09:25 schrieb David T. Lewis <[hidden email]>:

On Thu, Aug 15, 2019 at 07:56:04PM +0000, Thiede, Christoph wrote:
> Hi, there.
>
>
> Is there any reason why we don't have Time>>#-?
>

Yes. Conceptually, it does not make sense because class Time does not
represent a magnitude. If you want to think of the time of day as a
magnitude, then class DateAndTime is probably what you want.

The class comment for Time explains:

If you need a point in time on a particular day, use DateAndTime.
If you need a duration of time, use Duration.

Dave