On 25 June 2010 05:27, Ryan Senior <senior.r...@gmail.com> wrote:
> (future-await fut2 2 :minutes) ; => "done"

Your implementation points into the right direction (again, IMHO). I'd
like to offer two suggestions:

1. Leave out the three-arg version of future-await. The time unit
conversion seems somewhat superfluous, with little gain for the lines
of code added. Rich argued against writing thin wrappers around Java
stuff as well. And personally, I'd probably only ever use the two-arg
version with an integer in milliseconds, since that's what most
methods/functions are using anyway. (If you know of use cases for and
trust the system clock to act on milliseconds correctly, you could
also make the integer represent nanoseconds instead.)

2. Returning nil to represent timeout is dangerous here -- the future
may have completed correctly and returned nil! It should be perfectly
okay and idiomatic here to let the TimeoutException escape, as long as
you document this behaviour.

What do others think?
--
Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to