Re: Bug in try/finally?

2010-08-11 Thread Brian Stiles
You guys are awesome! Less than 24 hour turnaround. On Aug 10, 1:09 pm, Chouser chou...@gmail.com wrote: On Tue, Aug 10, 2010 at 2:51 PM, Chouser chou...@gmail.com wrote: That patch seems to essentially reverse this one:

Re: Bug in try/finally?

2010-08-11 Thread Chouser
On Tue, Aug 10, 2010 at 1:09 PM, joegg joega...@gmail.com wrote: This fixes the behavior we're seeing, but, ummm... might break other things, I suppose.  The tests I've written don't cover all the expected behavior of try/catch/finally. You wrote some nice tests for these that could be

Re: Bug in try/finally?

2010-08-11 Thread Chouser
On Wed, Aug 11, 2010 at 8:01 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Ticket and patch welcome! Done and done: https://www.assembla.com/spaces/clojure/tickets/422 --Chouser http://joyofclojure.com/ -- You received this message because you are subscribed to the Google Groups

Re: Bug in try/finally?

2010-08-11 Thread joegallo
On Aug 11, 9:02 am, Chouser chou...@gmail.com wrote: Have you sent in your CA? It's in the capable hands of the USPS. Joe -- 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

Bug in try/finally?

2010-08-10 Thread Brian Stiles
The following succeeds: (try (prn 1) (finally (prn 2) (doto (System/out) (.print -) (.println - prints: 1 2 -- The following fails (note the odd duplication of 2 in the output): (try (prn 1) (finally (prn 2) (.. (System/out) (print -) (println - prints: 1 2 -2

Re: Bug in try/finally?

2010-08-10 Thread Meikel Brandmeyer
Hi, On Aug 10, 8:36 am, Brian Stiles brian.sti...@gmail.com wrote: The following succeeds: (try   (prn 1)   (finally    (prn 2)    (doto (System/out) (.print -) (.println - prints: 1 2 -- The following fails (note the odd duplication of 2 in the output): (try   (prn 1)  

Re: Bug in try/finally?

2010-08-10 Thread Christian Vest Hansen
The bug has nothing to do with try-finally. Take a look at the macro expansion: user= (macroexpand '(.. (System/out) (print -) (println -))) (. (. (System/out) (print -)) (println -)) You are trying to call 'println on what ever 'print returns. But 'print is a void method. On Tue, Aug 10, 2010

Re: Bug in try/finally?

2010-08-10 Thread Adrian Cuthbertson
Hi Brian, System/out #PrintStream java.io.printstr...@7d59ea8e (System/out) #PrintStream java.io.printstr...@7d59ea8e both return the out PrintStream object, so (.. System/out (print -)) -nil (.. (System/out) (print -)) -nil (.. System/out (print -)) -nil all invoke the print method on the java

Re: Bug in try/finally?

2010-08-10 Thread Laurent PETIT
Weird indeed: user= (def a (atom 1)) #'user/a user= (try (prn :test) (finally (swap! a inc) (.foo nil))) :test java.lang.NullPointerException (NO_SOURCE_FILE:0) user= @a 3 I would have expected 2 as a result, in any case ? 2010/8/10 Meikel Brandmeyer m...@kotka.de Hi, On Aug 10, 8:36 am,

Re: Bug in try/finally?

2010-08-10 Thread joegg
Laurent, Looking through the output of javap -v, it looks to me like this is roughly what's been emitted (please forgive the mix of clojure and java): try { (prn :test) (swap! a inc) (.foo nil) } finally { (swap! a inc) (.foo nil) } Which explains why @a is 3 -- I'm not sure this is

Re: Bug in try/finally?

2010-08-10 Thread joegg
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/ Compiler.java index f5684f1..af55660 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -1775,7 +1775,7 @@ public static class TryExpr implements Expr{

Re: Bug in try/finally?

2010-08-10 Thread Chouser
On Tue, Aug 10, 2010 at 1:09 PM, joegg joega...@gmail.com wrote: diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/ Compiler.java index f5684f1..af55660 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -1775,7 +1775,7 @@ public

Re: Bug in try/finally?

2010-08-10 Thread Chouser
On Tue, Aug 10, 2010 at 2:51 PM, Chouser chou...@gmail.com wrote: That patch seems to essentially reverse this one: http://github.com/clojure/clojure/commit/5e9f2b293b307aa7953cd390360d24549e542b92 ...which suggests to me there must be a better solution, though I don't see yet what it would