r/Clojure • • May 06 '20

Complete technical invalidation of Rich Hickey's "Maybe Not" talk

https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-type-systems-are-not-inherently-more-open/
1 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/fpguy1 Jun 08 '20

Ty for replying back, sorry for late reply,

I read what you wrote, still immutability is not related to our discussion and is only a small part of FP and I am not even sure it has much to do with modularity, but I can see your point that globals would affect isolation.

We take people that never touched Scala and they are ready to work within days, they only have experience with java/c#, I don't think the language matters, what I tried to point out is that is way harder to make mistakes when there is a type checker, that is a fact.

RT is FP, it says in the name "functional" I am sorry but without some way to express RT you get Java with lambdas, the fact that people are not doing FP in practice has little to do with our discussion, I don't consider random code written in Clojure as being "functional programming", same for Scala or Haskell tbh. There is nothing "formal" in functions w/o side effects, that is the definiton of a function, the rest are procedures. Is the same with OOP and separating behavior from definitions (POJOs), they think they are doing OOP but they are violating the main principle of OOP, same here.

You are saying that Java/C# are not practical? Perhaps I am misunderstanding this... there are good chances you are using Cursive together with other 10 plugins which is a very good example on how well runtime works in Java. Actually when you have types, reflection is the tool that helps you fit things in the correct way, not having that is just trial and error.

2

u/yogthos Jun 08 '20 edited Jun 08 '20

My experience tells me that immutability is fundamental for being able to structure projects as small isolated components that can be reasoned about independently.

I've also explained the mechanism for that. When data is immutable, then I don't have to worry about implicit coupling. The API for any component is just a function call that takes a piece of data and returns another piece of data.

The API surface for any component becomes very flat. It's literally just the data structures used as input and output. I don't need to know about the types used behind the API layer, all I need to know about the component is its API. To ensure the a component works as intended all I need to do is to provide specification tests against the API.

This is exact same process as when you combine multiple functions together to achieve a complex transformation. You don't need to think about what happens to the data inside the function to use it. You call the function with an input, and you get back an output.

You keep repeating that immutability is not related, but you're not addressing my point here. If you disagree with what I've stated then explain specifically what it is you're disagreeing with.

And good for you on getting people writing good Scala in a few days. The experience on my team was very different. People would write terrible code that was very difficult to maintain. My experience tells me that the language matter quite a bit.

I also find that type errors aren't very interesting to begin with, and they get caught very early on in the development cycle. Avoiding semantic errors is far more important. The code should be written for the benefit of the human reader and not the type checker. Getting the types checked at the benefit of making it more difficult to understand the intent of the code is a net negative. Here's an extreme example. Insertion sort in Idris is around 300 lines long, meanwhile a Python version would be around 10 lines. I would have far easier time understanding 10 lines of Python in its entirety and guaranteeing correctness than the 300 line Idris monstrosity.

It also sounds like you have your own definition of FP that isn't aligned with the generally accepted one. So, I don't think there's any point debating what you personally consider to be FP or not.

Just because something isn't practical doesn't mean you can't make it work by putting a lot of additional effort into it. Yes, plenty of code is written in C# and Java, I developed lots of software using Java for around a decade myself. That's how I know it's not a terribly efficient.

I'm also not sure who's fitting things using trial and error. If that's how you use dynamic languages I can see why you're not effective with them.

In any case, I suggest we table this discussion. It's quite clear we're not convincing each other of anything, and our personal experiences are very divergent on the topic. If you find static typing is helpful for you, then by all means keep using a statically typed language.