Hacker News new | ask | show | jobs
by eklavya 3187 days ago
I was really surprised as well. Maybe Clojure people are really smart :P

I would still take typed over untyped any day.

1 comments

It really does just boil down (in my opinion) to code size. A small program is going to have fewer bugs than a large program. And Clojure programs can be quite small compared to the same programs written in other languages.

While I too am attracted to the static typing in many ways, I have found in my own experience of working in C++ full time for a few years (with some non-trivial work in Swift as well, which has quite a strict type system), and then Clojure full time for a few years, that when you measure all the other features of a language, typing alone does not make a big difference.

It's kind of like the argument some people make about how the cost of your rent or mortgage is the best indicator of your cost of living. There are so many other factors, and some of the lowest cost of living I've personally experienced has been in places with considerably higher rent than average, due to the offset of other factors.

I am finding it hard to believe that Clojure can beat Haskell/Scala in code size by a huge margin.
Why is that hard to believe? Static typing always add some code size, even in languages with inference.

On top of that, the pervasive use of macros in lisp tend to lead to a kind of code-reuse that languages without macros lack.

Not to say that Haskell can't be concise also, just not to the same degree. And I've seen very long lines in Scala that were due to pleasing the compiler's typing.

Elm and Clojurescript offer a good contrast. Elm is written in Haskell and is not too unlike Haskell syntax and general language use. I've written in both Elm and Clojurescript and there is nearly a 2X difference in code size of Elm over Clojurescript for accomplishing similar non-trivial tasks.

Code size isn't everything, but it is important.

If you still find it that hard to believe, just try Clojure for awhile, and I think it will be clear. It's a tradeoff. When you don't have to satisfy a type checker for everything, you do write less code, that's just a matter of fact most of the time.

The question is whether the increased code size of a statically-type language over a lisp makes up for the extra developer resources and potential for bloat-related bugs. But that is of course the core of the typing debate.

Elm is nowhere near Haskell or Scala in expressibility. You would have to compare Purescript/GHCJS/ScalaJS. In the native Haskell/Scala land I usually don't have to do much ceremony and the functional code is succinct and a pleasure to write. They may lack the all powerful macros of LISPs but the need to reach for a macro seldom arises.

The original point wasn't about code size it was about bugs and I was surprised to see Clojure doing better than the very strongly typed ones. Hence the comment on the smartness of Clojure people ;)

I will agree that there are a lot of really smart people in the Clojure community, but that is also true in other communities. Some of the most brilliant developers I know are hard-core C++ guys.

The original point about bugs is in my opinion, regarding my comment you replied to, very similar to a discussion about code size. There are some great reads [0] that go into further depth on this issue, if you are curious.

[0] https://github.com/papers-we-love/papers-we-love/blob/master...