2015-05-28 19:42 GMT+02:00 Mohit Thatte <[email protected]>:
>
> The interesting question here is what constitutes useful information!
>
(let [pred #(exists? ".foo")]
(wait-until pred)) ;; <- the fact that it's called 'pred is not
interesting in most cases
> The trade-off is breaking an existing public API.
>
How so?
(defmacro op [msg args expr]
`(with-meta (fn ~args ~expr) {:msg ~msg :args '~args :expr '~expr}))
(let [pred1 #(exists? ".foo")
pred2 (op "checks existance" [] (exists? ".foo"))]
;; both these will work, the one with pred1 will give less useful errors.
the API of wait-until is unchanged
(wait-until pred1)
(wait-until pred2))
If Shalaka's primary goal is prettier errors in test failures, I'd settle
> for the fn body itself as the error message and that could be achieved
> without breaking the API.
>
The op macro can include the code in its information.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.