Hey all, The docstring of clojure.core/realized? states "Returns true if a value has been produced for a promise, delay, future or lazy sequence.", however calling realized? on a cancelled future returns true, despite the fact a value *has not* been produced.
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. Thus, attempting to print (with pr) a cancelled future throws a CancellationException, in contrast to - agents which have thrown an exception: agent-error is called, and the exception is printed, and - delays which have thrown an exception: .isRealized returns false, so no deref is attempted and :pending is printed. This inconsistency feels like a bug, but I'd like confirmation/thoughts in case I'm missing something. Thanks, -- *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.