On Nov 14, 3:50 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> On Nov 14, 2008, at 3:11 PM, Howard Lewis Ship wrote:
>
> > The point is, an exception that said something like:
>
> > "Expected java.lang.Comparable but received :king" would have helped
> > me unravel this much, much easier!
>
> I agree. Clojure should give all the information it can about the
> object(s) involved in the failure. There are other places where the
> class of the object is given, but not its string representation. Any
> juicy info that's easily available should be made part of the
> exception message.

I'm certainly interested in improving the error reporting, but in this
partiicular case:

 java.lang.ClassCastException: clojure.lang.LazyCons

is my all-time pet-peeve exception message, and it comes from the JVM.
Why on earth they didn't report the types of both what you had and
what you were trying to cast to is completely baffling and can only be
described as a bug, which seems to be fixed in JDK 6, which reports
"XXX cannot be cast to YYY".

For every library and every app to have to wrap every cast in a try
block simply in order to get this message to say what it ought to is
not productive, IMO.

One issue with trying to capture string representations is that they
can be arbitrarily long.

Rich

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to