News for hackers. Stuff that matters.
Re:Introduction to Clojure by jacquesm on Saturday October 17, 2009 @02:14PM (#887208)
> Throwing java.lang.Exception if a condition is not meat in your clojure functions? Don't do this either!!!

What's the proper way of doing that in clojure ?

Re:Introduction to Clojure by alrex021 on Saturday October 17, 2009 @03:17PM (#887304)
-way- is not the problem here. The java.lang.Exception is. :-) Throw specialized "Runtime Exceptions" would be the way to go. For example throw IllegalArgumentException runtime exception if function call receives inappropriate arguments.

You can also define your own specific (app-level) exception by proxying the RuntimeException or other relevant using the clojure's proxy macro.

Re:Introduction to Clojure by jacquesm on Saturday October 17, 2009 @03:29PM (#887318)
Ah right! Apologies, I took it to mean that there was a better way of throwing an exception, not that particular one.

Of course, that makes perfect sense.