[squeak-dev] Delay for: 60 seconds vs. Delay forSeconds: 60.

Frank Shearar frank.shearar at angband.za.org
Fri Jan 8 08:57:54 UTC 2010


Göran Krampe wrote:
> Hi!
> 
> Frank Shearar wrote:
>> Andreas Raab wrote:
>>> Hi there -
>>>
>>> I just realized how silly it is to write code like:
>>>
>>>     (Delay forSeconds: 60) wait.
>>>     (Delay forMilliseconds: 1000) wait.
>>>
>>> when we have units available and might as well say:
>>>
>>>     (Delay for: 60 seconds) wait.
>>>     (Delay for: 5 days + 3 hours + 17 minutes) wait.
>>>
>>> What do people think about this? Overkill or just right?
> 
> Presuming we have no real performance issue I would say the latter is 
> probably what we should use - earlier we didn't have Durations in the 
> library, but now that we do we should probably go "all the way" to get 
> all the polymorphic glory.

There are few things more annoying to me than having to constantly check 
the units of that integer you need to pass in to a function: is that 
Timeout parameter in milliseconds or seconds? Using Durations everywhere 
solves the problem.

frank



More information about the Squeak-dev mailing list