Hi!

Boy I really think you've all done a nice job with Clojure. I've used quite 
a few environments over the years and clojure + CIDER + etc is a great 
experience. The immutability and threading are smart. I've been able to 
finish a hobby project in clojure which I've been mulling for a long time 
and never found the right environment. Super stuff.

And the error messages are not good.

So I was wondering: Is this a philosophical thing? Or is it an effort 
thing? And if it is an effort thing, is there some sort of plan for what 
effort to put in? And if so, can I help by closing tickets?

Here's one, for instance, which bugs me (using a build of branch master in 
clojure from github just now)

user=> (+ 1 1)

2

user=> (1 + 1)

ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn  
user/eval17 (NO_SOURCE_FILE:10)




OK but what sort of noob would actually type in 1 + 1? (That's a joke. Lots 
of people would. And I do sometimes when switching between java and 
clojure) But that same error pops up if you misalign in parenthesis or 
confuse an argument order or do a variety of other things.

And that error message is terrible. I mean I know why it is there. Clojure 
needs the first element of a list be the function position and 1 is not a 
function, it is a long. But you have to squint rather generously at that 
message to get to the problem. Or just learn what that message "really" 
means, which seems a bit unfriendly.

And so when I go look inside the source 

user=> (print-stack-trace *e 20)

java.lang.ClassCastException: java.lang.Long cannot be cast to 
clojure.lang.IFn

 at user$eval9.invokeStatic (NO_SOURCE_FILE:6)

    user$eval9.invoke (NO_SOURCE_FILE:6)

    clojure.lang.Compiler.eval (Compiler.java:6978)

    clojure.lang.Compiler.eval (Compiler.java:6941)



Compiler.java has

                                IFn fn = (IFn) fexpr.eval();

                                return fn.invoke();


Which of course throws a class cast exception.


But there's so much information right there. Imagine this (in pseudo-code) 
as


Object f = fexpr.eval();

if (f instanceof IFn) return (IFn)f.invoke()

else throw ClojureNotAFunctionEvaluationError "First position in form at 
line " ... " of environment " ... " is not a function object. You handed me 
" + fexpr.first() " in form " ... " which has type " fexpr.first().class() 
" and value " fexpr.first().toString()


or whatever (like maybe don't toString values - that's why you'd want a 
plan. And maybe use a string table so you can internationalize. Again, plan 
:) )


so I almost want to whack this sort of stuff into a local copy as I hit 
error messages which bug me, but that seems foolish. And anyway I'm new 
here.


Sorry if I have accidentally stepped into some sort of landmine or if this 
has been rehashed a million times.


But I figured, in the spirit of being willing to help if there's help to be 
applied, I would ask if there's some sort of thinking on this topic for 
1.9.1 or 1.10 or something?


Thanks


  Paul

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to