Compiling a list of these common errors is a great idea (particularly if
then turned into some kind of How-To guide for interpreting errors)

I think anyone who learns Clojure learns to subconsciously internalize
these errors and what they mean. However, for somewhat just starting out
this is pretty hard.

Another very common one:
(first 1) ; => IllegalArgumentException Don't know how to create ISeq from
...

Comes up in many circumstances, some of the most confusing are when it
happens in an ns form or other macro.

In general beginning Clojure users don't know what ISeq, IFn,
clojure.lang.Numbers.ops etc are. I'd rather see error messages like

"Argument to 'first' cannot be coerced to a sequence (ISeq)"
or
"Expression in function call position '"asdf"' does not implement function
interface (IFn)"

I have no idea if theres technical reasons that make this hard, but haven't
some resource to let users translate the current exception messages into
what they mean in terms of Clojure concepts that would be very useful I
think.






On Sat, Feb 6, 2016 at 4:37 PM, Paulo César Cuneo <
cuneo.paulo.ce...@gmail.com> wrote:

> Hi group,
>      I was googling for enumeration of commons runtime errors in clojure,
> but i couldnt find anything much.
> Stuart Sierra  has a couple of blog post on do/donts in clojure, but is
> not an exhaustive listing.
>
> I understand that using interop will inherit most of the runtime errors
> you can create in java,
>  but even when staying inside the clojure realm there are some common
> cases of errors.
>
> For example,
>
> 1 - applying type specific ops on wrong type :
> ;; math ops.
>
> (+ 1 nil)  ; => NullPointerException.
> (+ 1 "")   ; => ClassCastException.
>
> 2 - call on non-callable:
>
> (map nil [1 2 3]) ; => NullPointerException.
> ("asdf" 2)           ; => ClassCastException.
>
> 3 - cant destruct
>
> (let [[f s] 1] f) ; => UnsupportedOperationException nth
>
>
> I guess most of errors are due to bad plumbing.
> Do you have any insights on these or more examples?
>
> Bye and 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
> ---
> 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.
>

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