Hacker News new | ask | show | jobs
by dopidopHN 1339 days ago
It’s two different things.

For instance using more functional language convinced me of the vertus of immutability.

Pattern won’t do that

1 comments

> Patterns won’t do that

I’m pretty sure Clean Code by Uncle Bob has a section on why you should use const to achieve immutable variables. In any case, good style guides inevitably are preaching this as well, as are good senior engineers.

All in one’s first language (human), without needing to understand lambda calculus, or monads to run a hello world.

> I’m pretty sure Clean Code by Uncle Bob has a section on why you should use const to achieve immutable variables.

Doesn't go far enough.

Firstly, it's just advice. I might like it, but it doesn't mean I can get my teammates to do it.

Secondly, if I want to do it, I have to get it right, any mistakes I make are on me.

Thirdly, const is not enough. You'll probably end up with immutable pointers to mutable data, rather than any kind of referential transparency.

A language which helps you get immutability right is a world of difference. It's like the difference between a memory-safe language vs just using C (and a C textbook which recommends that you write memory-safe code)

> A language which helps you get immutability right is a world of difference. It's like the difference between a memory-safe language vs just using C (and a C textbook which recommends that you write memory-safe code)

I mean I understood how to get immutability right before I ever picked up an FP language, but I can see how this is a flexible point though. The virtues of immutability really don’t take a long time to extol, and they’re a concept you’re introduced to immediately in MyFirstFPLang™.

Of course; but reading it from clean code 10 years ago I thought “yeah sure”.

Having no way to mutate my variable in List or Elm or scala … and seeing first hand that a lot whole class of bug disappeared, is different.

But we need both ! Absolutely both. And I will probably never code again in scala or lisp. That was fun. I learned a few things ( scala taught me how functional codebase can be unreadable as well )