The Trunk: Chronology-Core-eem.63.mcz

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

The Trunk: Chronology-Core-eem.63.mcz

commits-2
Eliot Miranda uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-eem.63.mcz

==================== Summary ====================

Name: Chronology-Core-eem.63
Author: eem
Time: 2 December 2020, 11:42:13.044649 am
UUID: 713cef96-205d-4f67-95f1-cabd0bb1b3f3
Ancestors: Chronology-Core-mt.62

Nicer code for a couple of Duration methods...
I'm doing this to help me remember 5 seconds wait et al...

=============== Diff against Chronology-Core-mt.62 ===============

Item was changed:
  ----- Method: Duration>>asDelay (in category 'squeak protocol') -----
  asDelay
 
+ ^Delay forMilliseconds: self asMilliSeconds
- ^ Delay forDuration: self
  !

Item was changed:
  ----- Method: Duration>>wait (in category 'squeak protocol') -----
  wait
+ "Convert this duration in a delay and wait once. Answer the created delay so that the client can wait on it again if needed."
- "Convert this duration in a delay and wait once. Return the created delay so that the client can wait on it again if needed.
 
+ "[3 seconds wait] timeToRun"
- Do-it: 3 minutes wait"
 
+ ^self asDelay wait!
- | delay |
- delay := self asDelay.
- delay wait.
- ^ delay!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Chronology-Core-eem.63.mcz

David T. Lewis
On Wed, Dec 02, 2020 at 07:42:15PM +0000, [hidden email] wrote:

> Eliot Miranda uploaded a new version of Chronology-Core to project The Trunk:
> http://source.squeak.org/trunk/Chronology-Core-eem.63.mcz
>
> ==================== Summary ====================
>
> Name: Chronology-Core-eem.63
> Author: eem
> Time: 2 December 2020, 11:42:13.044649 am
> UUID: 713cef96-205d-4f67-95f1-cabd0bb1b3f3
> Ancestors: Chronology-Core-mt.62
>
> Nicer code for a couple of Duration methods...
> I'm doing this to help me remember 5 seconds wait et al...
>

Noting the change to Duration>>asDelay I wondered if there was any remaining
benefit to Delay class>>forDuration:.

Warning: This is definitely in the "angels dancing on the head of a pin"
category, but hopefully still constructive.

If we wanted to get rid of unnecessary methods, I would say that we should
deprecate Delay class>>forDuration: because:

  1) It has no users in the image and there is no obvious need for it.

  2) Its implementation is redundant with Delay class>>forMilliseconds:

However, I do not think we should deprecate this, and in fact I think
I somewhat prefer the earlier implementation of Duration>>asDelay.

Why? Because conceptually, Delay class>>forDuration: is better. It does
not carry an implied precision for durations, and in fact there is no
reason that we should expect delays to be restricted to some arbitrary
precision (milliseconds in this case) even if the current implementation
does exactly that.

So IMHO the earlier idiom of "Delay forDuration: self" rather than
"Delay forMilliseconds: self asMilliseconds" carries its weight based on
conceptual clarity even if the implementation is pointlessly redundant.

$0.02 and *please* don't change it, I'm just offering an observation.

Dave


> =============== Diff against Chronology-Core-mt.62 ===============
>
> Item was changed:
>   ----- Method: Duration>>asDelay (in category 'squeak protocol') -----
>   asDelay
>  
> + ^Delay forMilliseconds: self asMilliSeconds
> - ^ Delay forDuration: self
>   !
>
> Item was changed:
>   ----- Method: Duration>>wait (in category 'squeak protocol') -----
>   wait
> + "Convert this duration in a delay and wait once. Answer the created delay so that the client can wait on it again if needed."
> - "Convert this duration in a delay and wait once. Return the created delay so that the client can wait on it again if needed.
>  
> + "[3 seconds wait] timeToRun"
> - Do-it: 3 minutes wait"
>  
> + ^self asDelay wait!
> - | delay |
> - delay := self asDelay.
> - delay wait.
> - ^ delay!
>
>