r/programming • • Jun 11 '16

My Increasing Frustration With Clojure

http://ashtonkemerling.com/blog/2016/06/11/my-increasing-frustration-with-clojure/
176 Upvotes

225 comments sorted by

View all comments

116

u/argv_minus_one Jun 11 '16

Rich Hickey said in 2009 “the fact that these functions happen to work when the second argument is not a set is an implementation artifact and not a promise of the interface”.

And that, children, is why dynamic typing is a fucking horrible idea.

46

u/stgabe Jun 11 '16

100 times this.

Arguments for dynamic typing, IME, always come down to someone confusing typing speed with programmer productivity. Don't get me wrong, it's certainly possible to misuse types and create headaches, but with modern typed languages and moderately reasonable programmers that's easy to avoid. The value you get from setting explicit contracts on code, generating tens of thousands of implicit/free unit tests on your code and improving readability is too huge to pass up just because someone's too lazy to type out a type signature.

-4

u/Serializedrequests Jun 12 '16 edited Jun 12 '16

This is not absolutely true. You have to realize the reason for a lot of dynamic languages is it was hard to get any work done in Java or C++ of the kind that scripting languages are good at.

Now there are other modern typed languages, but the old guard is still going strong and finally getting much needed upgrades.

But Java's type system still feels like something you have to fight more often then not, a lot of popular design patterns are just for working around it, and all references being nullable means that there will always be a giant escape hatch from safety. Compared to Java (which I work in every day) I would still take Ruby or Python. Most of my job is just shuffling strings around so they look pretty to clients

Compared to newer typed languages, the benefits of scripting languages are a little less clear.

4

u/stgabe Jun 12 '16

I think scripting languages are fine for disposable code. If all you're doing is "shuffling strings" then maybe it's fine to use whichever language has your favorite RegEx engine and acknowledge that you're creating write-only code that you shouldn't expect anyone else to understand/maintain (including yourself in a month). As long as you're in an an environment where occasional bugs aren't a big deal anyway.

1

u/Serializedrequests Jun 13 '16

I would not call a 100k line Rails project I have been working on off and on for the last two years unmaintainable or disposable. It has a clear set of conventions that are repeated over and over, and a comprehensive and easy-to-update test suite that proves it works.

Now there are bad things about it to be sure. Not arguing that, but Ruby also makes it very easy to use good patterns. The ease of prototyping of this language can actually be a big win for maintainability.

Just saying it's not all black and white. I have been working a lot with Elm so I get the benefits of that kind of Haskell-y typing, but there is also a lot of wiring to do before I can add a single feature in it, and the learning curve compared to imperative languages is very high.

0

u/stgabe Jun 13 '16

It's not that you can't do it, just that you shouldn't. As for the "wiring" that is almost always because of a framework you're using and not because of types themselves. You can rapidly prototype quite easily in Java and C++ and still have types. I've written full games in days (even hours) with both and without any casting from void shenanigans. Typing speed != productivity.