For now, I just want to get the most useful stuff into git. Patch submitted: http://www.assembla.com/spaces/clojure-contrib/tickets/58
On Jan 13, 5:03 pm, Timothy Pratley <timothyprat...@gmail.com> wrote: > Hi Alex, > > 2010/1/13 ataggart <alex.tagg...@gmail.com>: > > > You mean dropping it from the level-specific macros such as error and > > fatal? I'm inclined to disagree; being able to access the exception > > instance itself is a Good Thing. > > Yes. You are quite right; preserving the exception is more important. > > If I understand correctly, the latest version is used as follows: > (log/spy foo) > (log/error "OMG!!" exception) > (log/debugp exception "OMG!! foo:" foo) > (log/debugp "OMG!! foo:" foo "should be impossible") > (log/debugf "OMG!! foo: %d should be impossible" foo) > (log/debugp "Something expected resulted in" foo) > > I'm worried that log and logp having opposite overloading it will trip > users up. But I don't see a good alternative, and it might not be a > valid concern, just an initial reaction. > > Writing the calls out like this made me realize that many use cases > for debugp are similar to spy and would be much more informative if > using spy. But perhaps spy has some limitations in that it takes a > single expression, which is very good when you want to leave the > expression in place (+ x (spy y)). It might be convenient to have > automatic spy-like expansion in a println-like format: > (when (> 10 (+ x y)) > (log/spyp "Oh dear," (+ x y) "should never happen." x y) > (dosomethingaboutit)) > ;logs "Oh dear, (+ x y) => 5 should never happen. x => 3 y => 2" > ;should spyp return a value though? maybe the name is badly chosen. > > And/or it might be nice to have some sort of (log/assertp pred expr > print-expr) form. > (log/assertp (partial < 10) (+ x y)) "Oh dear" x y) > ;logs "(+ x y) => 5 Oh dear x => 3 y => 2" > ;throws via (assert ...) java.lang.AssertionError: Assert failed: > ((partial < 10) (+ x y)) (NO_SOURCE_FILE:0) > > Would these be welcome additions, or polluting an already full namespace? > > > I'm also including the optimization I mentioned earlier regarding > > skipping the instance? check for the common case where a string > > literal proves there's no throwable param. > > Neat trick! > > Regards, > Tim.
-- 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