As reflected in the linked discussion and Jira ticket, it seems possible to 
be able to use -ea/-da with Clojure. It would definitely require a compiler 
change, and I'm not aware of any further movement to make Clojure's asserts 
use a mechanism compatible with -ea/-da.

An additional annoyance (as I mentioned in the linked thread) is that there 
isn't really a way to easily disable assertions. Clojure supports some 
properties for configuring compilation 
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compile.java#L28-L30
 
but not a property to enable/disable assertions.

I've worked around it before by defining my own assert macro and using 
(refer-clojure :exclude [assert]), in order to be able to toggle assertions 
myself. 
https://github.com/pjstadig/deque-clojure/blob/master/src/name/stadig/deque.clj#L23-L27


Paul

On Thursday, October 10, 2013 4:43:55 PM UTC-4, lop...@gmail.com wrote:
>
> Dear All,
>
> Is it possible to use Java assertion system in Clojure?
>
> I want to put invariant checks in my code which can be turned on/off at
> runtime with java -ea/-da.
>
> http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html
>
> The only mention touching this issue in Clojure I could find is
>
> https://groups.google.com/forum/#!topic/clojure-dev/kUCVUEALmWI
>
> it does not give any constructive suggestions, though.
>
> Has anybody used this JVM facility in Clojure code?
>
> Thanks in advance for any of your hints!
>
> Best regards,
> Michal
>
>

-- 
-- 
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/groups/opt_out.

Reply via email to