Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like to say that immutability is a really good idea in the 1990s, especially considering how counterculture it would have been at the time. I don't mean that as diminutive or patronizing, I'm serious. It was a good cutting edge idea.

However, nobody had any experience with it. Now we do. And I think what that experience generally says is that it's a bit overkill. We can do better. Like Rust. Or possibly linear types, though that is I think much more speculative right now. Or other choices. I like mutable islands in a generally immutable/unshared global space as a design point myself, as mutability's main problem is that it gets exponentially more complicated to deal with as the domain of mutability grows, but if you confine mutability into lots of little domains that don't cross (ideally enforced by compiler, but not necessarily) it really isn't that scary.

It was a necessary step in the evolution of programming ideas, but it's an awful lot to ask that it be The One True Idea for all time, in all places, and that nobody in the intervening decades could come up with anything that was in any way an improvement in any problem space.




> I like to say that immutability is a really good idea in the 1990s, especially considering how counterculture it would have been at the time. I don't mean that as diminutive or patronizing, I'm serious. It was a good cutting edge idea.

> However, nobody had any experience with it. Now we do.

Working intimately with C++ in the '90s, immutability as a concept was neither considered counterculture nor without significant experience employing it. At that time and in C++, it was commonly known as "const correctness" and was a key code review topic.

Go back another decade or two when K&R C ruled the land and that's a different story ;-).


Indeed, my 1990's C++ code is full of const methods.


>And I think what that experience generally says is that it's a bit overkill. We can do better. Like Rust.

Or OCaml perhaps ? They have taken a very pragmatic approach to fp and allow mutations because thats the pragmatic choice sometimes.


The funniest thing is that to compile Rust, enabling various compiler features (like borrow checker etc), the code has to be transmuted into non-mutable one Single Static Assignment form :V


And in the functional world, Lean 4 achieves language level support for local mutation, early return, etc. in the same way, by converting it into non-mutating code:

https://dl.acm.org/doi/10.1145/3547640


In some ways, CPS as compilation target already went that way.

Sure, ultimately the code mutates values in place, but the specific actions are modeled as pure operations


All this immutability discussion is more about going against "old school object orientation" which promoted keeping state spread out around a lot of mutable object instances.


> Or other choices. I like mutable islands in a generally immutable/unshared global space as a design point myself, [...]

That's pretty easy to do in eg Haskell or even Rust.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: