Hey Peter, On 19 February 2013 17:55, Peter Taoussanis <ptaoussa...@gmail.com> wrote:
> Hi Alex, > > This is a problem because the print-method multimethod implementation for >> clojure.lang.IDeref assumes that if the .isRealized method returns true, >> it's safe to deref the instance. >> > > That's interesting. I've run into the case before where a cancelled future > was throwing an exception on print, and certainly found it quite strange. > Didn't think to look into it. This must be a bug, surely? > Yeah it does seem like a bug to me. Firstly, I think the mismatch between the clojure.core/realized? docstring and the clojure.core/future implementation of isRealized should be fixed. This could prevent the exception being thrown when printing futures. Secondly, I think it'd be nice if print-method was aware of futures (as it is agents), and printed the exception or :cancelled, if that's the future's state (and possibly the same for delays too; it seems strange to say print ":pending" when they aren't). -- *Alex Nixon* Software Engineer | SwiftKey *a...@swiftkey.net** | http://www.swiftkey.net/* ++++++ WINNER - MOST INNOVATIVE MOBILE APP<http://www.swiftkey.net/swiftkey-wins-most-innovative-app-at-mwc> - GSMA GLOBAL MOBILE AWARDS 2012 Head office: 91-95 Southwark Bridge Road, London, SE1 0AX TouchType is a limited company registered in England and Wales, number 06671487. Registered office: 91-95 Southwark Bridge Road, London, SE1 0AX -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.