Live data from Hacker News

Why I love Common Lisp and hate Java (2012)

kuomarc.wordpress.com

141–150 of 171 posts

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

#141

The issues mentioned are largely addressed by jshell and lambdas. Regardless, his issues mostly boil down to "Java is not a REPL-first and Lambda-first language". This is like me "hating" my cat because it's not a dog. I find many beginner programmers like REPL langs. When I talk to them, though, it becomes apparent that they've never worked on a code base with 100k+ lines with tens of colleagues. One guy actually su…

I think many Haskell, OCaml and Scala programmers would disagree heavily with you.

Repl driven development works very well with pure functional code and at no point did I feel an increase in loc begin to make it tedious or whatever.

The repl approach perhaps doesn't work as well in Java because Java and its ecosystem encourage writing messy jumbled code built upon unsafe abstractions.

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

#142
post #112

Earlier quoted context omitted.

Java has been gradually eating all the good parts of Scala. So far, it's eaten lambdas, map / reduce / fold functions, option types, raw string literals, the concept of a built-in REPL, type inference for local variables, and default methods in interfaces (which is kind of like mixins). Pattern matching and type classes are on the menu, but not yet formally merged into Java. So what does Scala have left? Operator ove…

> So what does Scala have left? This is why I think long term Groovy is better positioned than Scala, even if short term Scala has more of the mindshare. Groovy actually offers something fundamentally different, while Scala is perpetually trying to compete on Java's home turf. If people really want a pure, statically typed language Kotlin is pretty good and has less impedance mismatch with Java.

What fundamentally different does Groovy offer?

What do you mean by "Scala is trying to compete on Java's home turf"?

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

#143

Earlier quoted context omitted.

Exactly, and in the replies it is really obvious what the debate is really colored by. In many cases there is no debugger available for someone's favorite platform. And so they "hate debugging". Go programmers, javascript people (where you can't do client->server debugging, but really, really have to), ... How many Java programmers don't use debuggers ? How many C# developers ? Those languages have excellent debugger…

> Javascript/... dismal debugging support. Eh? I thought JavaScript debuggers were pretty good.

I always compare my React debugging experience to something like GWT debugging from 5 years back ... and I find it very lacking indeed.

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

#144

Earlier quoted context omitted.

Alice: Hey Bob, want to try my nifty new function? Bob: Sure, Alice, what does it do? Alice: It takes an object and it returns an object. Bob: But what does it actually do? Alice: I told you. It takes an object and it returns an object. Bob: But what does it do with the object? What's it for? Why should I use it? Alice: Hey, I just gave you the full documentation for my function. You have everything you need. Now go…

Thankfully, Haskell supports much nicer types than only `Object`

Alice: Hey Bob, want to try my nifty new function?

Bob: Sure, Alice, what does it do?

Alice: It takes a string and it returns an integer.

Bob: But what does it actually do?

Alice: I told you. It takes a string and it returns an integer.

Bob: But what does it do with the string? What's it for? Why should I use it?

Alice: Hey, I just gave you the full documentation for my function. You have everything you need. Now go use it.

Bob: Um, no thanks. I like to know more about what I'm getting myself in to.

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

#145
post #142
post #112

Earlier quoted context omitted.

> So what does Scala have left? This is why I think long term Groovy is better positioned than Scala, even if short term Scala has more of the mindshare. Groovy actually offers something fundamentally different, while Scala is perpetually trying to compete on Java's home turf. If people really want a pure, statically typed language Kotlin is pretty good and has less impedance mismatch with Java.

What fundamentally different does Groovy offer? What do you mean by "Scala is trying to compete on Java's home turf"?

When Apache Groovy was first released, it offered closures and dynamic typing on the JVM ecosystem, but nowadays Java has lambdas and inferred typing, so Groovy doesn't really have much fundamentally different to offer anymore. And since version 2.x, Groovy is also "trying to compete on Java's home turf" because it has static-typing annotations, but Kotlin and Scala are probably better choices if you want static typing on the JVM because it was baked into them from the get-go instead of being bolted on as in Groovy 2.x.

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

#146
post #144

Earlier quoted context omitted.

Thankfully, Haskell supports much nicer types than only `Object`

Alice: Hey Bob, want to try my nifty new function? Bob: Sure, Alice, what does it do? Alice: It takes a string and it returns an integer. Bob: But what does it actually do? Alice: I told you. It takes a string and it returns an integer. Bob: But what does it do with the string? What's it for? Why should I use it? Alice: Hey, I just gave you the full documentation for my function. You have everything you need. Now go…

I think you're criticizing a language you have no experience in. Haskell development is type driven. You start by defining and constraining your types until you get a DSL to write signatures in. See the Idris O'reilly book for more on type driven development.

By the time you've added type constrains through typeclasses, selected types named after the domain, and selected a suitable name for the function, it's possible to write against the signature with no knowledge of the body or comments.

You're also forgetting that signature includes the name of the function.

reverse :: [a] -> [a] is easy to understand by it's name and type.

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

#147

Earlier quoted context omitted.

Most Haskellers write out the types even though they can be inferred. In a pure language, signatures are extremely close to documentation (you know exactly what a function will do by its signature). Java requires more code than Python or Haskell because it's extremely imperative and statement based. Python on the other hand includes a lot of functional, more expressive idioms like concise list comprehensions.

Types aren’t documentation, no matter how many Haskell users delude themselves thinking it is. Documentation is more than a function definition. Types don’t explain rationales and how to use functions and programs. Types don’t give proper examples.

I suggest reading Type-Driven Development with Idris by Edwin Brady. I don't think you have enough experience writing Haskell to understand the outcome of type driven development.

In Haskell you start by defining your domain as types, and constrain those types with typeclasses. By the time you get to writing signatures, the implementations can almost be inferred (in Idris they actually can be inferred, the code literally writes itself).

In an imperative language with side effects, examples and documentation are a must because behavior is hidden in the body of a function; the signatures lie.

A journeyman Haskeller can write code that is completely self documenting. No examples are required, because the types coupled with the purity of the language allows us to tell the whole story.

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

#148

Earlier quoted context omitted.

> StrictYAML can validate emails (using a simplified regex) Public Service Announcement: don't validate emails with regex. Every time you do, god kills a kitten.

Just checking for the @ symbol is fair game. Anything beyond that is a bad idea.

Agreed :)

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

#149
post #144

Earlier quoted context omitted.

Thankfully, Haskell supports much nicer types than only `Object`

Alice: Hey Bob, want to try my nifty new function? Bob: Sure, Alice, what does it do? Alice: It takes a string and it returns an integer. Bob: But what does it actually do? Alice: I told you. It takes a string and it returns an integer. Bob: But what does it do with the string? What's it for? Why should I use it? Alice: Hey, I just gave you the full documentation for my function. You have everything you need. Now go…

[deleted]

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

#150
post #144

Earlier quoted context omitted.

Thankfully, Haskell supports much nicer types than only `Object`

Alice: Hey Bob, want to try my nifty new function? Bob: Sure, Alice, what does it do? Alice: It takes a string and it returns an integer. Bob: But what does it actually do? Alice: I told you. It takes a string and it returns an integer. Bob: But what does it do with the string? What's it for? Why should I use it? Alice: Hey, I just gave you the full documentation for my function. You have everything you need. Now go…

[deleted]
Post reply on HN