I had code that looked like this:
(let [{count :count
data :data} (fetch-data)
real-count (count data)])
As you can see, I was inadvertently redefining the 'count' symbol, and then
tried to use the core 'count' function.
I thought the compiler usually warned about this sort of thing. But
instead, it gave me a java.lang.NullPointerException with no further
explanatory message. At least it told me the line of code where it was
happening.
It took me a few minutes to figure out what was happening because the real
code had a lot more details in it, so it was not immediately easy to see.
It was a bit frustrating. I wonder if it would be possible to have the
compiler issue a warning in cases like this? I am not necessarily saying it
should issue a warning every time 'count' gets redefined, but if I then try
to use it the way that the core function would be used, I would like it to
produce a warning.
--
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.