Re: Bug in try/finally?

2010-08-11 Thread joegallo
On Aug 11, 9:02 am, Chouser 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 from new members

Re: Bug in try/finally?

2010-08-11 Thread Chouser
On Wed, Aug 11, 2010 at 8:01 AM, Stuart Halloway 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 "Clojure" group. To post to thi

Re: Bug in try/finally?

2010-08-11 Thread Chouser
On Tue, Aug 10, 2010 at 1:09 PM, joegg 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 included in clojure-t

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 wrote: > On Tue, Aug 10, 2010 at 2:51 PM, Chouser wrote: > > > That patch seems to essentially reverse this one: > > >http://github.com/clojure/clojure/commit/5e9f2b293b307aa7953cd390360d... > > > ...which suggests

Re: Bug in try/finally?

2010-08-10 Thread Chouser
On Tue, Aug 10, 2010 at 2:51 PM, Chouser 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 be. Ok, i

Re: Bug in try/finally?

2010-08-10 Thread Chouser
On Tue, Aug 10, 2010 at 1:09 PM, joegg 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 static class

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{ gen.visitT

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 in

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 > Hi, > > On Aug 10, 8:36 am, Brian Stil

Re: Bug in try/finally?

2010-08-10 Thread Adrian Cuthbertson
Hi Brian, System/out # (System/out) # 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 PrintStream object and correctly return nil as does... (.print System/o

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

Re: Bug in try/finally?

2010-08-10 Thread Meikel Brandmeyer
Hi, On Aug 10, 8:36 am, Brian Stiles 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) >  

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: