Hi S, that's encouraging, I've to admit I've been poking at this for a few hours now, but I'm not as productive as the (real)programmers.
I've yet to read the following which is a how to submit patches:
http://dev.clojure.org/display/design/JIRA+workflowMeanwhile poking around, I've found the two locations that are showing
:pending and I've learned quite some things in the process. core_print.clj and dispatch.clj are the relevant files for showing the future ( => f ) respectively for (clojure.pprint/pprint f)
I've also found a few relevant inconsistencies between clojure.pprint/pprint and the normal printing (how do you call that), it's clearly no big deal since it's just printing:
(let [d (delay (throw (Exception. "a")) 100)] (print d) (clojure.pprint/pprint d) d)
#<Delay@8526fa: :pending>#<Delay@8526fa:
:not-delivered>
#<Delay@8526fa: :pending>
(let [d (delay (throw (Exception. "a")) 100)] (print d) (clojure.pprint/pprint d) d)
#<Delay@2caf64a6: :pending>#<Delay@2caf64a6: :not-delivered>
#<Delay@2caf64a6: :pending>
Notice that some say :pending and one says :not-delivered
I've also considered this case(or similar to others like promise/delay/future):
=>
(def d (delay (throw (Exception. "a")) 100))#'cloj2.ka/d
=>
d#<Delay@235c710: :pending>
=>
@dException a cloj2.ka/fn--7187 (NO_SOURCE_FILE:1)
=>
d
#<Delay@235c710: :pending>
At this time, I've been thinking that instead of :pending maybe there could be something else like :threw especially considering that it can never recover if it threw (right?), so having :pending might suggest that it is still working, maybe even pending is not quite right for delay. Maybe I'm getting too wannabe perfectionist here, after-all it's not one of my projects to do such detailed analysis :) - if it were, I'd be putting quite a few different messages here like: Delay :executing, Delay :threw, Delay :completed (and the return value)
I feel like I'm overthinking this, the only real issue is really that of printing an interrupted future should not throw.
At this time I'm not yet sure if I should pursue making a patch mainly because I feel it would be incomplete to just fix the printing future issue and not the other tiny things that I mentioned(but that's more of a fault in me for wanting all addressed) and also because it seems somewhat complicated to do, ie. required CA as I see here:
http://clojure.org/patches
Thanks.
PS: someone who knows can probably do the futures patch in under 10 minutes, it would take me some hours I admit :)
Whoever does it, don't forget to add test cases in
test_pretty.clj currently somewhere at line 231:
(tst-pprint 20 future-unfilled) #"#<Future@[0-9a-f]+: \r?\n :pending>"