r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

Show parent comments

1

u/yogthos Feb 23 '15

Well I guess there's something wrong with the Java compiler then and it's been around a bit longer than Clojure:

Object o = null;
o.getClass();
java.lang.NullPointerException: null

1

u/nickguletskii200 Feb 23 '15

That's a runtime error, not a syntax error. A better example would be this:

Object o =

And then the end of file, so the next token is null. The Java compiler, however, handles this.

1

u/yogthos Feb 23 '15

Now show me an equivalent of that in Clojure that makes the compiler return a nil and we'll talk.

1

u/nickguletskii200 Feb 23 '15

https://github.com/timmc/sscce-macro-readstring

I ran into something similar, but not exactly this. You can remove the first 4 lines in src/org/timmc/sscce/macro_readstring.clj and you will get something more like what I got.

1

u/yogthos Feb 23 '15

Except it runs fine with the latest version of Clojure:

git clone https://github.com/timmc/sscce-macro-readstring.git
Cloning into 'sscce-macro-readstring'...
remote: Counting objects: 33, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 33 (delta 9), reused 33 (delta 9)
Unpacking objects: 100% (33/33), done.
Checking connectivity... done.
~/s/tmp> cd sscce-macro-readstring/
~/s/t/sscce-macro-readstring> lein run
About to hit the bad code...
You're in this namespace: org.timmc.sscce.macro-readstring