Re: better error messages > smaller stack traces

2011-04-14 Thread Sam Aaron
Here's something that could be clearer (it wasn't obvious to me that something like addition would cause a null pointer exception): user=> (+ 1 nil) java.lang.NullPointerException (NO_SOURCE_FILE:0) Sam --- http://sam.aaron.name On 8 Feb 2011, at 14:01, Stuart Halloway wrote: > This conversat

Re: better error messages > smaller stack traces

2011-03-03 Thread Daniel Werner
On 2 March 2011 09:32, Alan wrote: > '(apply + 1 1) would be how you create a list of those symbols. > ('apply + 1 1) says "call the function 'apply with the arguments of + > 1 and 1". Note that this will still break at runtime because Integers are not seqable. :-) You probably want either (appl

Re: better error messages > smaller stack traces

2011-03-02 Thread Mark
Thanks! On Mar 2, 5:19 am, Ken Wesson wrote: > On Wed, Mar 2, 2011 at 3:32 AM, Alan wrote: > > '(apply + 1 1) would be how you create a list of those symbols. > > Or (list 'apply '+ 1 1) or `(apply + 1 1), both of which allow you to > put something variable in there, like (list 'apply '+ 1 x) or

Re: better error messages > smaller stack traces

2011-03-02 Thread Ken Wesson
On Wed, Mar 2, 2011 at 3:32 AM, Alan wrote: > '(apply + 1 1) would be how you create a list of those symbols. Or (list 'apply '+ 1 1) or `(apply + 1 1), both of which allow you to put something variable in there, like (list 'apply '+ 1 x) or `(apply + 1 ~x). -- You received this message because

Re: better error messages > smaller stack traces

2011-03-02 Thread Alan
'(apply + 1 1) would be how you create a list of those symbols. ('apply + 1 1) says "call the function 'apply with the arguments of + 1 and 1". On Mar 1, 8:37 pm, Mark wrote: > I found the problem: > ('apply + 1 1) > > I understand why this won't work if I tried to eval the list, but I > don't un

Re: better error messages > smaller stack traces

2011-03-01 Thread Mark
I found the problem: ('apply + 1 1) I understand why this won't work if I tried to eval the list, but I don't understand why I can't create a list of these symbols. On Feb 28, 9:06 am, Brian Marick wrote: > On Feb 27, 2011, at 2:33 PM, Mark wrote: > > > With a fresh brain (and a fresh cup of cof

Re: better error messages > smaller stack traces

2011-02-28 Thread Brian Marick
On Feb 27, 2011, at 2:33 PM, Mark wrote: > With a fresh brain (and a fresh cup of coffee), I realized this > message is probably caused (somehow) by my misuse of the midje > library. No doubt it does fancy macro stuff under-the-hood. Indeed it does. > One could certainly argue that the > macro

Re: better error messages > smaller stack traces

2011-02-27 Thread Mark
With a fresh brain (and a fresh cup of coffee), I realized this message is probably caused (somehow) by my misuse of the midje library. No doubt it does fancy macro stuff under-the-hood. At the core of this problem is that I'm a naive client of this macro library and by an innocent misuse, I am s

Re: better error messages > smaller stack traces

2011-02-27 Thread Daniel Werner
On 27 February 2011 20:50, Mark wrote: > I wrote that up quickly without thinking much about it.  Yes, the > invocation is definitely a macro and not a function.  Still, I think > it would be helpful to see the symbol's value and, if possible, the > macro's arity. Is calling symbols as a function

Re: better error messages > smaller stack traces

2011-02-27 Thread Mark
I wrote that up quickly without thinking much about it. Yes, the invocation is definitely a macro and not a function. Still, I think it would be helpful to see the symbol's value and, if possible, the macro's arity. On Feb 27, 1:13 pm, Ken Wesson wrote: > On Sun, Feb 27, 2011 at 2:10 PM, Ken We

Re: better error messages > smaller stack traces

2011-02-27 Thread Ken Wesson
On Sun, Feb 27, 2011 at 2:10 PM, Ken Wesson wrote: > On Sat, Feb 26, 2011 at 8:14 PM, Mark wrote: >> I get this: >> #> of args (3) passed to: Symbol (C:\Users\addma03\workspace\test\src\main >> \clojure:1)> >> >> A few suggestions: >> 1)  An improved line number >> 2) I'd like to see the value of

Re: better error messages > smaller stack traces

2011-02-27 Thread Ken Wesson
On Sat, Feb 26, 2011 at 8:14 PM, Mark wrote: > I get this: > # of args (3) passed to: Symbol (C:\Users\addma03\workspace\test\src\main > \clojure:1)> > > A few suggestions: > 1)  An improved line number > 2) I'd like to see the value of the Symbol > 3) I'd like to see the three args applies to the

Re: better error messages > smaller stack traces

2011-02-27 Thread Mark
I get this: # A few suggestions: 1) An improved line number 2) I'd like to see the value of the Symbol 3) I'd like to see the three args applies to the symbol and, if the symbol resolves to a function, I'd like to see the arity of the function. Something like: Wrong number of args (3) passed to

Re: better error messages > smaller stack traces

2011-02-25 Thread Stuart Halloway
> Here's one: > > user=> {:a 1 :b} > # > > Instead how about a parse error exception that specifically says > something like, "Map literal requires an even number of forms." > > Thanks, > Jeff Fixed in master today: http://dev.clojure.org/jira/browse/CLJ-742 Thanks! Stu -- You received this

Re: better error messages > smaller stack traces

2011-02-17 Thread Timo Mihaljov
On Tue, Feb 08, 2011 at 09:01:38AM -0500, Stuart Halloway wrote: > Please let us know when you get a misleading error message from a > macroexpansion, so we can make it better. Or contribute a patch along the > lines > of [2]. Here's another error message that really threw me off for a while. I

Re: better error messages > smaller stack traces

2011-02-14 Thread OGINO Masanori
Hello. There is an interesting model about error reporting: Clang, one of C-family languages compiler which uses LLVM. For example, if you mistake names, Clang searches similar names which really exist in current environment. And then Clang illustrates line, column and actual code. If you want to

Re: better error messages > smaller stack traces

2011-02-14 Thread Ken Wesson
On Mon, Feb 14, 2011 at 5:48 AM, Timo Mihaljov wrote: > On Tue, Feb 08, 2011 at 09:01:38AM -0500, Stuart Halloway wrote: >> Please let us know when you get a misleading error message from a >> macroexpansion, so we can make it better. Or contribute a patch along the >> lines >> of [2]. > > Here's

Re: better error messages > smaller stack traces

2011-02-14 Thread Timo Mihaljov
On Tue, Feb 08, 2011 at 09:01:38AM -0500, Stuart Halloway wrote: > Please let us know when you get a misleading error message from a > macroexpansion, so we can make it better. Or contribute a patch along the > lines > of [2]. Here's a misleading lack of an error message: (defn foo [x]

Re: better error messages > smaller stack traces

2011-02-13 Thread Jeff Rose
Here's one: user=> {:a 1 :b} # Instead how about a parse error exception that specifically says something like, "Map literal requires an even number of forms." Thanks, Jeff On Feb 8, 3:01 pm, Stuart Halloway wrote: > This conversation began on Twitter [1] but I want to continue it on the > ma

Re: better error messages > smaller stack traces

2011-02-12 Thread Ken Wesson
+1 for the assertion macro suggestions (custom messages). On the topic of stack traces: it's high time Clojure stopped generating shit like java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer (NO_SOURCE_

Re: better error messages > smaller stack traces

2011-02-12 Thread Daniel Werner
On 10 February 2011 21:33, Fogus wrote: > Additionally, I've always hoped for separate > PreConditionAssertionError and PostConditionAssertionError types, but > keep forgetting to discuss it. A while ago Stuart Sierra wrote about using typed assertions in unit testing. One of his points was to gi

Re: better error messages > smaller stack traces

2011-02-11 Thread Jeff Rose
Thanks Hubert, this is exactly what I'm talking about. D. Werner's recommendation to use a function call for the validation is a good point, but having a human readable message like this would be the most clear. Cheers, Jeff On Feb 10, 9:23 pm, Hubert Iwaniuk wrote: > Hi, > > Jeff correct me if

Re: better error messages > smaller stack traces

2011-02-10 Thread Fogus
> (defn f [x] {:pre [^{:msg "..."} (some-fancy-validation x)]} ..) That idea (or some variation) is actually kinda nice. Additionally, I've always hoped for separate PreConditionAssertionError and PostConditionAssertionError types, but keep forgetting to discuss it. -- You received this message

Re: better error messages > smaller stack traces

2011-02-10 Thread Hubert Iwaniuk
Hi, Jeff correct me if I'm wrong but I think you are after something along the following lines. Instead: (defn f [x] {:pre [(some-fancy-validation x)]} ..) To have something like this: (defn f [x] {:pre [^{:msg "here goes description of what has not been valid"} (some-fancy-validation x)]} ..)

Re: better error messages > smaller stack traces

2011-02-10 Thread Daniel Werner
On 10 February 2011 17:05, Jeff Rose wrote: > Sorry for the reply spam, but I've just remembered another error > reporting issue: pre and post conditions.  They are a great feature > and I'd like to use them more often, but the error messages they > produce are virtually useless in comparison to j

Re: better error messages > smaller stack traces

2011-02-10 Thread Fogus
> reporting issue: pre and post conditions.  They are a great feature > and I'd like to use them more often, but the error messages they > produce are virtually useless in comparison to just writing your own > check with a custom exception.  How about having optional error > messages for the condit

Re: better error messages > smaller stack traces

2011-02-10 Thread Jeff Rose
Sorry for the reply spam, but I've just remembered another error reporting issue: pre and post conditions. They are a great feature and I'd like to use them more often, but the error messages they produce are virtually useless in comparison to just writing your own check with a custom exception.

Re: better error messages > smaller stack traces

2011-02-10 Thread Jeff Rose
Here's an error I just got that could be improved upon. It shows an error in a file core.clj, but my current project uses many libraries and there are multiple files named core.clj. How about putting the full path to the file somewhere so we can jump straight to it? Thanks, Jeff ---

Re: better error messages > smaller stack traces

2011-02-08 Thread Brian Goslinga
I have been working on a fork of Clojure to explore what can be done w.r.t. error messages: https://github.com/qbg/clojure Currently it fixes a misleading error message generated by (int [5]), it aligns the IndexOutOfBoundsExceptions with those thrown by the collections classes, and it explores the

Re: better error messages > smaller stack traces

2011-02-08 Thread Stuart Halloway
>> Please let us know when you get a misleading error message from a >> macroexpansion, so we can make it better. Or contribute a patch along the >> lines of [2]. >> > > What medium is best? Discussion here on the mailing list is fine, or a JIRA ticket [1]. We follow both. Thanks! Stu [1] h

Re: better error messages > smaller stack traces

2011-02-08 Thread Brian Marick
On Feb 8, 2011, at 8:01 AM, Stuart Halloway wrote: > > Please let us know when you get a misleading error message from a > macroexpansion, so we can make it better. Or contribute a patch along the > lines of [2]. > What medium is best? - Brian Marick, Artisanal Labrador Contract program

Re: better error messages > smaller stack traces

2011-02-08 Thread daly
On Tue, 2011-02-08 at 09:01 -0500, Stuart Halloway wrote: > This conversation began on Twitter [1] but I want to continue it on > the mailing list as it may be of broader interest. > > > The core team is very interested in improving error messages, and > relatively less interested in more code to

Re: better error messages > smaller stack traces

2011-02-08 Thread Alex Ott
Hello Stuart One of problem, that sometime arise (at least for me) - errors in code that is performed lazily - stack trace contains data about point where it's evaluated, not where it's created: for example, let look to something like: I have a function that combines several functions (defn make