Live data from Hacker News

Why I love Common Lisp and hate Java (2012)

kuomarc.wordpress.com

11–20 of 171 posts

Re: Why I love Common Lisp and hate Java (2012)

#11

Earlier quoted context omitted.

> Do you really want print() to be so easily accessible in the top-level namespace? It seems to me that the bigger an application gets, the worse it is to easily litter the codebase with print statements. Yes? It's great for debugging, which is generally what you'd use a print for anyways in a large application.

Whats even better than print for debugging is using a debugger...

Doesn't quite work when debugging a distributed system, though. You end up adding a lot of "distributed print", AKA logging.

Re: Why I love Common Lisp and hate Java (2012)

#12
post #6
post #2

If you are running JDK 9 or later, you can use jshell: jshell> "Hello World!" $1 ==> "Hello World!" https://openjdk.java.net/jeps/222

And lambdas were introduced in 8 making nearly all of the author’s issues mute.

*moot

You're right, but to be fair the article is almost 7 years old, and Java has evolved a lot.

Re: Why I love Common Lisp and hate Java (2012)

#13
post #2

If you are running JDK 9 or later, you can use jshell: jshell> "Hello World!" $1 ==> "Hello World!" https://openjdk.java.net/jeps/222

Turns out C# also has a REPL now, it's called "C# interactive". I've found out just now, spurred to look for it by your post.

Re: Why I love Common Lisp and hate Java (2012)

#14

Earlier quoted context omitted.

Whats even better than print for debugging is using a debugger...

Doesn't quite work when debugging a distributed system, though. You end up adding a lot of "distributed print", AKA logging.

Fair enough, but attaching multiple debuggers across several interacting components with conditional breaks gets me there faster than incrementally inserting progressively more print statements, in a dev environment. Proper logging is a given doping out problems in a production system to then verify and correct in dev.

Re: Why I love Common Lisp and hate Java (2012)

#15
post #6
post #2

If you are running JDK 9 or later, you can use jshell: jshell> "Hello World!" $1 ==> "Hello World!" https://openjdk.java.net/jeps/222

And lambdas were introduced in 8 making nearly all of the author’s issues mute.

I'm curious, how much Common Lisp have you written yourself. Because what I'm reading between the lines is that you consider modern Java to be pretty much equal to Common Lisp in power, and that doesn't make much sense from here.

Take lambdas for example, the amount of arbitrary exceptions you have to keep in mind while using them makes it almost not worth the effort. It's still the same old crappy Java; only with shiny, barely working marketing gimmicks duct taped to the side.

Re: Why I love Common Lisp and hate Java (2012)

#16

Earlier quoted context omitted.

> Do you really want print() to be so easily accessible in the top-level namespace? It seems to me that the bigger an application gets, the worse it is to easily litter the codebase with print statements. Yes? It's great for debugging, which is generally what you'd use a print for anyways in a large application.

Whats even better than print for debugging is using a debugger...

I disagree. Most of the time, I find a debugger just slows me down. It's super helpful in some cases, but good logs can pinpoint problems far before a debugger can. Also, building in debug mode can change everything, so you may not even catch your bug, especially if it's concurrent in nature.

Re: Why I love Common Lisp and hate Java (2012)

#17

Earlier quoted context omitted.

Doesn't quite work when debugging a distributed system, though. You end up adding a lot of "distributed print", AKA logging.

Fair enough, but attaching multiple debuggers across several interacting components with conditional breaks gets me there faster than incrementally inserting progressively more print statements, in a dev environment. Proper logging is a given doping out problems in a production system to then verify and correct in dev.

Logs aren't a bad thing and they aren't going away. Whoever let's you setup debuggers on prod should be fired.

Re: Why I love Common Lisp and hate Java (2012)

#18
post #2

If you are running JDK 9 or later, you can use jshell: jshell> "Hello World!" $1 ==> "Hello World!" https://openjdk.java.net/jeps/222

Java is not really designed for a REPL though. I've used REPL like environments in Swift long before, this and it simply never feels right IMHO compared to a real dynamic language.

And Swift is a much better designed language for this than Java.

Re: Why I love Common Lisp and hate Java (2012)

#19
post #7

It is a recurring theme for people to point out how verbose a hello world program is in Java: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } For argument sake, let's compare it not to Lisp but to Python instead: print("Hello World!") Once you get proficient in a language and start writing larger programs, your perspective can change entirely. What appears to be…

> Do you really want print() to be so easily accessible in the top-level namespace? It seems to me that the bigger an application gets, the worse it is to easily litter the codebase with print statements. Yes? It's great for debugging, which is generally what you'd use a print for anyways in a large application.

You really should be using a logging framework instead though, if you're working on a large application.

Re: Why I love Common Lisp and hate Java (2012)

#20
post #7

It is a recurring theme for people to point out how verbose a hello world program is in Java: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } For argument sake, let's compare it not to Lisp but to Python instead: print("Hello World!") Once you get proficient in a language and start writing larger programs, your perspective can change entirely. What appears to be…

> In Java the top level only contains classes and interfaces.

This design makes sense from conceptual purity, but Java is never a conceptually pure language. It distinguishes value types and object types, for instance. Not allowing free functions is really just a poor design choice.

Worse, the proliferation of single-method interfaces (which are really just functions) and static methods (which are in most cases really just free functions) really prove that free functions are useful. Java just makes it harder to use them.

Post reply on HN