Re: :pre and :post throwing Exception - is this a smell?

2009-12-29 Thread Rich Hickey
On Wed, Dec 23, 2009 at 5:03 PM, Mark Derricutt wrote: > 'lo, > > I was reading http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ > on the new pre and post conditions and seeing that they throw > java.lang.Exception kinda struck me as a bad smell, esp. when > integrating with other systems wr

Re: :pre and :post throwing Exception - is this a smell?

2009-12-24 Thread Daniel Werner
On Dec 24, 7:08 am, Mike Douglas wrote: > Previously: > "Caused by: java.lang.Exception: Assert failed: (= % x)" With your patch, assert does not include x in its message anymore in case s is not given. Also, as a non-native speaker I find the phrase "failed when" somewhat strange to my ears. Asi

Re: :pre and :post throwing Exception - is this a smell?

2009-12-23 Thread Mike Douglas
Hi, I've written a related patch that makes three changes: 1. assert now raises AssertionError, instead of Exception. 2. assert is now overloaded with a second parameter that replaces "Assert failed" in the original message. 3. the (pre- or post-) condition that raised the exception, along with t

Re: :pre and :post throwing Exception - is this a smell?

2009-12-23 Thread Sean Devlin
It would be nice if the exception string stated if it was a pre or post condition failure at the very least. On Dec 23, 5:03 pm, Mark Derricutt wrote: > 'lo, > > I was readinghttp://blog.fogus.me/2009/12/21/clojures-pre-and-post/ > on the new pre and post conditions and seeing that they throw > j

:pre and :post throwing Exception - is this a smell?

2009-12-23 Thread Mark Derricutt
'lo, I was reading http://blog.fogus.me/2009/12/21/clojures-pre-and-post/ on the new pre and post conditions and seeing that they throw java.lang.Exception kinda struck me as a bad smell, esp. when integrating with other systems written in Java or another language. Forcing upstream clients to catc