Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Tassilo Horn
David Nolen dnolen.li...@gmail.com writes:

Hi David,

 Do you see the same issue when working with lazy sequences? We
 definitely don't eat exceptions.

No, exceptions in lazy sequences show up fine.

  (defn blow-up [i]
(map #(/ 1 %) (iterate inc i)))

  (take 200 (blow-up -100))
  ;Divide by zero
  ;  [Thrown class java.lang.ArithmeticException]
  ; ...Backtrace...
  ; Evaluation aborted.

If I wrap that call with a (run* [q] ...), then I get a different
exception (with no backtrace), because a lazy seq is used in a place
where an IFn is expected.

Hm, I do get some backtraces inside `run', for example for such an
obvious top-level error.

  (run 10 [q] (/ 1 0))

  0:Numbers.java:156 clojure.lang.Numbers.divide
  1:   Numbers.java:3677 clojure.lang.Numbers.divide
  2:NO_SOURCE_FILE:1 de.uni-koblenz.ist.funtg.funrl/eval6264[fn]
  3:   logic.clj:885 clojure.core.logic/eval2958[fn]
  4: LazySeq.java:42 clojure.lang.LazySeq.sval
  5: LazySeq.java:67 clojure.lang.LazySeq.seq
  6: RT.java:466 clojure.lang.RT.seq
  7:core.clj:133 clojure.core/seq
  8:   core.clj:2499 clojure.core/take[fn]
  9: LazySeq.java:42 clojure.lang.LazySeq.sval

If I hide the division by zero inside some relation, though, then the
exception doesn't put me in the debugger.

  (defn wrongo [a b]
(fn [s]
  (unify s [a b] [1 (/ 1 0)])))

  (run 10 [q] (wrongo q 0))
  ; Evaluation aborted.

  (pst *e)
  ArithmeticException Divide by zero
clojure.lang.Numbers.divide (Numbers.java:156)
clojure.lang.Numbers.divide (Numbers.java:3677)
de.uni-koblenz.ist.funtg.funrl/wrongo/fn--6233 (NO_SOURCE_FILE:1)
clojure.core.logic.Substitutions (logic.clj:207)
de.uni-koblenz.ist.funtg.funrl/eval6282/fn--6283/fn--6284/-inc--6285 
(NO_SOURCE_FILE:1)
clojure.core.logic/eval2958/fn--2959/fn--2960 (logic.clj:885)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:67)
clojure.lang.RT.seq (RT.java:466)
clojure.core/seq (core.clj:133)
clojure.core/take/fn--3836 (core.clj:2499)
clojure.lang.LazySeq.sval (LazySeq.java:42)
  nil

Comparing the backtraces, the obvious difference is the generated names.
I wasn't even aware that a function's qualified name may contain more
than one slash.  Maybe the problem is that clj-stacktrace stumbles upon
those names?

But on the other hand: since *e contains the last exception and that is
the divide by zero exception and not some exception from clj-stacktrace,
this doesn't seem very likely...

But I'm still interested where those names come from.  I mean, the names
of anonymous functions defined in other functions is usually something
like user/wrongo$fn3923, right?

Bye,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Tassilo Horn
Tassilo Horn tass...@member.fsf.org writes:

Hi again,

 Maybe the problem is that clj-stacktrace stumbles upon those names?

 But on the other hand: since *e contains the last exception and that
 is the divide by zero exception and not some exception from
 clj-stacktrace, this doesn't seem very likely...

Debugging a bit further I came to the conclusion that it's
clj-stacktrace's fault that errors with certain stack frames.

  (run* [q] (wrongo 1 2))
  ; Evaluation aborted.

  *e
  = #ArithmeticException java.lang.ArithmeticException: Divide by zero

  (clj-stacktrace.core/parse-exception *e)
  ; Evaluation aborted.

  *e
  = #NullPointerException java.lang.NullPointerException

  (pst *e)
  NullPointerException 
  = nil

So while letting clj-stacktrace parse the ArithmeticException, an
NullPointerException was thrown.

By tracing the functions in clj-stacktrace.core (contained in
swank-clojure-1.3.4.jar) I was able to determine the throwing function
call inside clj-stacktrace.  The following call throws a
NullPointerException.

  (clojure-ns clojure.core.logic.Substitutions)
  ; Evaluation aborted

The definition in the swank-clojure-1.3.4.jar is

(defn- clojure-ns
  Returns the clojure namespace name implied by the bytecode class name.
  [class-name]
  (utils/re-gsub #_ - (utils/re-get #([^$]+)\$ class-name 1)))

For the given argument, the `re-get' form returns nil which causes the
null pointer.  It's simply not ready for getting the namespace of a
protocol.

I fixed the definition directly in the swank-clojure-1.3.4.jar and then
wanted to write a patch against clj-stacktrace's git master branch.  As
it turns out, it's already fixed in there.  Funnily, it was Phil himself
who committed that patch written by Michael van Acken.

Phil, maybe you want to release a new swank-clojure version with an
updated clj-stacktrace?

Bye,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Baishampayan Ghose
 I fixed the definition directly in the swank-clojure-1.3.4.jar and then
 wanted to write a patch against clj-stacktrace's git master branch.  As
 it turns out, it's already fixed in there.  Funnily, it was Phil himself
 who committed that patch written by Michael van Acken.

 Phil, maybe you want to release a new swank-clojure version with an
 updated clj-stacktrace?

Kudos to Tassilo for some great detective work!

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-10 Thread Phil Hagelberg
Tassilo Horn tass...@member.fsf.org writes:

 I fixed the definition directly in the swank-clojure-1.3.4.jar and then
 wanted to write a patch against clj-stacktrace's git master branch.  As
 it turns out, it's already fixed in there.  Funnily, it was Phil himself
 who committed that patch written by Michael van Acken.

 Phil, maybe you want to release a new swank-clojure version with an
 updated clj-stacktrace?

Oops! I should have suggested you try it with swank 1.4.0-SNAPSHOT.
Thanks for tracking that down.

I would love to cut a stable release of 1.4.0, but it's currently
blocked on having a stable release of the cdt library which it uses as a
debugger. Hopefully this will happen soon. In the mean time, the
snapshot seems to be relatively stable.

-Phil

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread Phil Hagelberg
Tassilo Horn tass...@member.fsf.org writes:

 One thing that really made the programming extremely hard was that I
 don't get any backtraces if an exception occurs inside a `run'.  For
 example, I get this in SLIME with M-x clojure-jack-in RET.

   (defn wrongo [a b] false) ;; intentionally broken
   ;= #'logic-introduction.extend/wrongo
   (run* [q] (wrongo 1 2))
   ; Evaluation aborted.

Does the problem only happen with specific exceptions coming from
core.logic or is it a general problem? If it's the latter I'm afraid I
can't reproduce, so I need more details before I can do anything.

If you can find the places where clj-stacktrace is used inside
swank-clojure and wrap them in try/catches that do .printStackTrace you
might be able to discover more about the cause. Or if it's something
specific to using core.logic please provide steps for how to reproduce,
preferably in the issue tracker.

thanks,
Phil

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread Tassilo Horn
Phil Hagelberg p...@hagelb.org writes:

Hi Phil,

 One thing that really made the programming extremely hard was that I
 don't get any backtraces if an exception occurs inside a `run'.  For
 example, I get this in SLIME with M-x clojure-jack-in RET.

   (defn wrongo [a b] false) ;; intentionally broken
   ;= #'logic-introduction.extend/wrongo
   (run* [q] (wrongo 1 2))
   ; Evaluation aborted.

 Does the problem only happen with specific exceptions coming from
 core.logic or is it a general problem?

It seems to be specific to exceptions thrown inside core.logic.  For
example, all those put me in the SLIME debugger just as it should be:

  (run* [q] (/ 1 0))  = ArithmeticException
  (run* [q] (wrongo 1))   = ArityException

However, exceptions thrown inside core.logic don't show up.

  (run* [q] (wrongo 1 2))
  ; Evaluation aborted.
  (clojure.repl/pst *e)
  ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
clojure.core.logic.Substitutions (logic.clj:207)
de.uni-koblenz.ist.funtg.funrl/eval5744/fn--5745/fn--5746/-inc--5747 
(NO_SOURCE_FILE:1)
clojure.core.logic/eval2975/fn--2976/fn--2977 (logic.clj:885)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:67)
clojure.lang.RT.seq (RT.java:466)
clojure.core/seq (core.clj:133)
clojure.core/take/fn--3836 (core.clj:2499)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:466)
clojure.core/seq (core.clj:133)
  nil

 If you can find the places where clj-stacktrace is used inside
 swank-clojure and wrap them in try/catches that do .printStackTrace
 you might be able to discover more about the cause.  Or if it's
 something specific to using core.logic please provide steps for how to
 reproduce, preferably in the issue tracker.

I'll do so, but not this evening.  Now that I know of *e and `pst', it
lost much of its importance, anyway. :-)

Bye,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread David Nolen
Do you see the same issue when working with lazy sequences? We definitely
don't eat exceptions.

On Monday, January 9, 2012, Tassilo Horn tass...@member.fsf.org wrote:
 Phil Hagelberg p...@hagelb.org writes:

 Hi Phil,

 One thing that really made the programming extremely hard was that I
 don't get any backtraces if an exception occurs inside a `run'.  For
 example, I get this in SLIME with M-x clojure-jack-in RET.

   (defn wrongo [a b] false) ;; intentionally broken
   ;= #'logic-introduction.extend/wrongo
   (run* [q] (wrongo 1 2))
   ; Evaluation aborted.

 Does the problem only happen with specific exceptions coming from
 core.logic or is it a general problem?

 It seems to be specific to exceptions thrown inside core.logic.  For
 example, all those put me in the SLIME debugger just as it should be:

  (run* [q] (/ 1 0))  = ArithmeticException
  (run* [q] (wrongo 1))   = ArityException

 However, exceptions thrown inside core.logic don't show up.

  (run* [q] (wrongo 1 2))
  ; Evaluation aborted.
  (clojure.repl/pst *e)
  ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
clojure.core.logic.Substitutions (logic.clj:207)

 de.uni-koblenz.ist.funtg.funrl/eval5744/fn--5745/fn--5746/-inc--5747
(NO_SOURCE_FILE:1)
clojure.core.logic/eval2975/fn--2976/fn--2977 (logic.clj:885)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:67)
clojure.lang.RT.seq (RT.java:466)
clojure.core/seq (core.clj:133)
clojure.core/take/fn--3836 (core.clj:2499)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:466)
clojure.core/seq (core.clj:133)
  nil

 If you can find the places where clj-stacktrace is used inside
 swank-clojure and wrap them in try/catches that do .printStackTrace
 you might be able to discover more about the cause.  Or if it's
 something specific to using core.logic please provide steps for how to
 reproduce, preferably in the issue tracker.

 I'll do so, but not this evening.  Now that I know of *e and `pst', it
 lost much of its importance, anyway. :-)

 Bye,
 Tassilo

 --
 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 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

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Anthony Grimes
The last stacktrace that occurred in a REPL is bound to *e. Try 
(.printStackTrace *e). That should work in the REPL. Might not in SLIME.

-- 
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

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Tassilo Horn
Anthony Grimes disciplera...@gmail.com writes:

Hi Anthony,

 The last stacktrace that occurred in a REPL is bound to *e. Try
 (.printStackTrace *e). That should work in the REPL. Might not in
 SLIME.

Yes, that does the trick.  Ambrose also pointed me to (clojure.repl/pst
*e) which is as good.

Thanks,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Mark
I'm very interested in using core.logic to query a relational database or 
other data store.  I figure querying custom java objects is a good example 
of how to tackle this problem.

Would you mind posting your code somewhere?

-- 
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

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Phil Hagelberg
Tassilo Horn tass...@member.fsf.org writes:

 The ; Evaluation aborted. instantly appears.  No backtrace, no error
 message, not even in the *swank* buffer.

 If I use a plain lein repl instead, I get at least an error message:

   (run* [q] (wrongo 1 2))
   ; ClassCastException java.lang.Boolean cannot be cast to
   ; clojure.lang.IFn  clojure.core.logic.Substitutions (logic.clj:207)

 But where is my backtrace?

The Clojure REPL has actually never provided stack traces for you.

 I suspected it may have something to do with clj-stacktrace (0.2.4)
 which I had installed as lein plugin.  So i deleted

   ~/.lein/plugins/clj-stacktrace-0.2.4.jar

 and tried again with the same results.

 But although I deleted the clj-stacktrace jar (and validated that
 there's no such jar anymore on my whole system using sudo updatedb 
 locate clj-backtrace), when I type (/ 1 0) at the REPL to provoke an
 error, I still get a coloured, indented backtrace.

 Why?  Does leiningen ship with a built-in clj-stacktrace version?  If
 so, how can I deactivate it to check if that's my backtrace eater?

Swank Clojure 1.3.4 and 1.4.0-SNAPSHOT depend on clj-stacktrace now.
Since lein plugins are uberjars, you won't necessarily see
clj-stacktrace as a separate file.

Can you provide version numbers for Emacs and Swank? Also if M-x
toggle-debug-on-error shows any details when the stack trace is
swallowed that would be helpful.

-Phil

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Tassilo Horn
Phil Hagelberg p...@hagelb.org writes:

Hi Phil,

   (run* [q] (wrongo 1 2))
   ; ClassCastException java.lang.Boolean cannot be cast to
   ; clojure.lang.IFn  clojure.core.logic.Substitutions (logic.clj:207)

 But where is my backtrace?

 The Clojure REPL has actually never provided stack traces for you.

Ok.  It was my first time using it, because the SLIME REPL always worked
that nice for me. :-)

 Why?  Does leiningen ship with a built-in clj-stacktrace version?  If
 so, how can I deactivate it to check if that's my backtrace eater?

 Swank Clojure 1.3.4 and 1.4.0-SNAPSHOT depend on clj-stacktrace now.
 Since lein plugins are uberjars, you won't necessarily see
 clj-stacktrace as a separate file.

I see.

 Can you provide version numbers for Emacs and Swank?

Emacs 24 from yesterday's bzr trunk.
clojure-mode-1.11.4 from marmalade
Leiningen 1.6.2 on Java 1.7.0_147-icedtea OpenJDK 64-Bit Server VM

I have the following lein plugins installed:

  lein-clojars-0.6.0.jar
  swank-clojure-1.3.4.jar
  lein-test-bang-bang-0.2.0-SNAPSHOT.jar

 Also if M-x toggle-debug-on-error shows any details when the stack
 trace is swallowed that would be helpful.

No, it doesn't pop up, so there's no error on the emacs side.

Bye,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Tassilo Horn
Mark markaddle...@gmail.com writes:

Hi Mark,

 I'm very interested in using core.logic to query a relational database
 or other data store.  I figure querying custom java objects is a good
 example of how to tackle this problem.

 Would you mind posting your code somewhere?

I want to write a blog posting about it.  I'll post a link here.

Bye,
Tassilo

-- 
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


Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-06 Thread Mark
Great!  Thanks

-- 
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