If I write this in a file:
(defn different-order [order]
{:pre [
(map? order)
(:waiter order)
(:customer order)
(:menu-item-name order)
]
:post [
(map? %)
(:waiter %)
(:customer %)
(:menu-item-name %)
]}
)
and then I try "lein uberjar" I get:
Exception in thread "main" java.lang.RuntimeException: Unable to resolve
symbol: % in this context
but if I add a line of code to the function body:
(defn different-order [order]
{:pre [
(map? order)
(:waiter order)
(:customer order)
(:menu-item-name order)
]
:post [
(map? %)
(:waiter %)
(:customer %)
(:menu-item-name %)
]}
(println "hi")
)
Then it compiles.
At the very least, we should have a better error message than "Unable to
resolve symbol: % in this context". Something like "function definition is
incomplete" would at least communicate what the problem is.
But if this really needs to be treated as an error, I would like to know
why it needs to be an error. This does not generate an error:
(defn different-order [order] )
So why does adding a :post assertion create a compile time error? I'd
expect a runtime error, but not a compile time error.
--
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.