This is a discussion that I've had a couple of times. I don't think that
interop is the main factor here, I think it's more that I'm programming
against a large codebase I don't understand well (I can't since it's around
4 million LOC). I suspect that if I were programming against a large
undocumented Clojure codebase I'd have similar problems, or worse.

Note that Java interop often gets the blame here, but it's worth pointing
out that in Clojure everything is Java interop in the end. (+ 1 x) or
(str/trim x) will give you an NPE as easily as in Java if you pass nil in
x. And even if Java interop *is* the root cause of the problem, supposedly
interop is idiomatic in Clojure, and interfacing with existing Java systems
is a key use case for continuing Clojure adoption. I don't think that the
type of application that Cursive is is as much of an outlier as people
think - anyone integrating with an existing system will probably face
similar problems. Indeed, after my previous conversations, several people
contacted me to say that their experience matched mine in similar systems.

People have also asked me about whether nil punning helps. In my
experience, it allows for some elegant code but it has a really terrible
tendency to mask bugs and push them much further into the system than would
otherwise be the case. It would be nice to be able to say that I'm
expecting a collection to be non-nil, and to get an NPE at the point of the
collection call if it's nil due to a bug, rather than just silently
returning nil and continuing.

Also, when tracking down an NPE from a bug report, if there are collection
methods in the stack trace I now have to consider (at least) 3 cases: the
collection is unexpectedly nil, the collection is unexpectedly empty, or
the collection unexpectedly contains a nil value. This greatly increases
the space of problems that I have to consider as possibilities when trying
to work out what's going on.



On 21 October 2016 at 05:39, Daniel <doubleagen...@gmail.com> wrote:

> Just curious... What do you think the primary contributing factor is for
> Cursive's NPEs? Java interop?
>
> --
> 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.

Reply via email to