RE: [STM] Better name for waitUntil?

waitUntil sounds like a plausible name. Better than itsAfter or timeAfter. But perhaps sleepUntil would be better, because it's a variant of sleep? Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Tomasz Zielonka | Sent: 19 December 2005 09:28 | To: GHC-users | Subject: [STM] Better name for waitUntil? | | Hello! | | I am finishing my waitUntil implementation for STM. It's a new | STM action that will allow to wait for a given time point. | | waitUntil :: UTCTime -> STM () | | (UTCTime is from Ashley Yakeley's Time library.) | | The intended semantics is that | | waitUntil t | | will succeed as soon as time passes t, or more precisely when (now >= t). | | Right now I am to find a better name for waitUntil. Maybe it should be | more declarative, like "itsAfter" or "timeAfter"? I am not a native english | speaker, so I am probably missing many options. Any ideas? | | I also think about adding something like "itsBefore", which would mean | (now < t). | | How about "it'sAfter" ? | Maybe only "after", without "it's" ? | | Thanks in advance for your help. | | PS. I imagine that it would be possible to implement waitUntil more | efficiently in GHC's RTS, but my implementation can be a nice | showcase for STM's expressivity, and it's still quite efficient | (I used some (quite elegant :) hacks to implement subsecond | precision waitUntil efficiently). | | 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 | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

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 / ??? 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 Peyton-Jones
-
Tomasz Zielonka