This would be an appropriate kind of check for a lint tool like Eastwood to make, and warn about. It currently does not do so, but I've created an issue to remind me of the potential enhancement. [1]
It is up to the Clojure core team to decide whether they would like to make such a change to the Clojure compiler itself. My guess is that since this is legal Clojure code, and sometimes people do this in their code intentionally (i.e. use let-bound names that happen to match Var names in clojure.core and other namespaces), they might prefer _not_ to have the compiler issue such a warning. Note these words: "my guess". I have no inside knowledge here. Andy [1] https://github.com/jonase/eastwood/issues/81 On Wed, Jul 30, 2014 at 9:34 AM, Meel Velliste <meel.velli...@gmail.com> wrote: > 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 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 > --- > 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 clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.