Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

(< nil 3) produces the error Cannot invoke "Object.getClass()" because "x" is null. Is there any room for improvement here?

My gut tells me that this hasn't been done due to performance reasons, but another user made the observation in Slack that it's in the static public Boolean lt(Object x, Object y) { branch of Numbers.java, so it might not be terrible to add the null checks to improve the error message.


1 Answer

0 votes

Your gut is correct about the perf consideration. I'd love to see a timing comparison between the existing code and one that checks nulls. Any potential change (or not) would start with that I think.