RE: [STM] Better name for waitUntil?

On 19 December 2005 09:43, Tomasz Zielonka wrote:
On Mon, Dec 19, 2005 at 09:34:19AM -0000, Simon Peyton-Jones wrote:
waitUntil sounds like a plausible name.
But how do I name "itsBefore"? dontWaitUntil? ;-)
Better than itsAfter or timeAfter.
But perhaps sleepUntil would be better, because it's a variant of sleep?
Well yes, but an STM compatible one, so you can simultaneously waitUntil and try to read from channel, and you get whatever happens first. Also, the interface is entirely in STM - no need to initialize the timer in IO. Simon Marlow gave a nice example for usefulness of this:
Interesting. You could use that do wait for idle time, for example:
atomically $ do t <- readTVar last_mouse_click waitUntil (t+1000) ...
so this transaction only completes when some idle time has passed since the last mouse click.
Let's assume I am going to implement itsBefore (seems to be quite straightforward), so I want a pair of opposite names. Some variations:
itsAfter / itsBefore guardTimeAfter / guardTimeBefore waitUntil / ???
How about retryIfEarlierThan / retryIfLaterThan retryIfBefore / retryIfAfter I like making it clear that the operation behaves like retry given certain conditions. Cheers, Simon

On Fri, Dec 23, 2005 at 03:45:54PM -0000, Simon Marlow wrote:
How about
retryIfEarlierThan / retryIfLaterThan retryIfBefore / retryIfAfter
I like making it clear that the operation behaves like retry given certain conditions.
I like these proposals! Thanks! I think I prefer the retryIfBefore/retryIfBefore version. In a private email Simon Peyton-Jones proposed retryBefore / retryAfter. It's interesting that you think so similarly ;-) This also convinces me that these are the best names. I was going to release a cabal package with these functions a week ago, but life didn't allow me to. Stay tuned ;-) Best regards Tomasz -- I am searching for a programmer who is good at least in some of [Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland
participants (2)
-
Simon Marlow
-
Tomasz Zielonka