News for hackers. Stuff that matters.
Re:Immutable Data by phrenicfraud on Monday June 26, 2023 @03:42AM (#36476851)
> Immutable data in databases has all the same advantages as immutable data in general purpose languages. It is usually much easier to reason about than mutable state. See: Referential Transparency.

It's only hard to reason about mutable state if you don't understand it and if you don't understand it you have no business touching it. And yes I know, blah blah legacy software cope words words words... Jump the sinking ship because bailing it with a bucket is worthless and find a company where such things aren't allowed.

Now let me clarify, it's not a fault of languages that "allow" mutable state if previous programmer was allowed to build a god object that manages everything in inexplicable ways just like an actual god would. It's a fault of entire company being rotten from all the way to top and using language that "prevents it" (it really doesn't) wouldn't have changed the position you're currently in.

We have these things callied "code reviews" where shit code is simply not allowed to be committed, if your company never used it you're doing what OceanGate just did last week. If you don't get out now you're an idiot.

Re:Immutable Data by phrenicfraud on Monday June 26, 2023 @04:24AM (#36477143)
It seems like all redditors moved here hence the downvotes without elaboration. Well, it's not my problem if you want to keep dreaming, I'll continue living in reality where if I don't want things to change, I simply will not change them, not rely on obscure and irrelevant languages to prevent me from doing so.
Re:Immutable Data by smokel on Monday June 26, 2023 @04:49AM (#36477316)
I did not downvote your comment, but the downvotes might be because your message was formulated quite strongly.

Perhaps if you offer a more nuanced view, people may agree more and upvote it as well.

If your stance on mutability is really so strong, then you have to actually persuade people about your views, and that takes quite some effort (mostly from the person to be persuaded, not from you.) Being friendly instead of dismissive might make people more eager to take on another perspective.

Hope this helps a bit for future situations :)

Re:Immutable Data by 59nadir on Monday June 26, 2023 @07:31AM (#36478332)
I think your comment would've been better received if you maybe phrased it as a question that encouraged some discourse.

"Do people really feel like languages and systems that enforce immutability help them? I'd be interested in any arguments for handling immutability with language restrictions over code guidelines, because I'm not seeing how we need these restrictions on a language level to get the benefits we want."

The above has a clear stance and still encourages conversation, I think. For what it's worth, I mostly agree with you that in the end, I don't really give a shit if we can mutate things. In fact, I think the places where our software falls apart the most (performance on different axes) would benefit from being able to mutate things for sure.

Re:Immutable Data by boredumb on Monday June 26, 2023 @08:11AM (#36478676)
Not even sure if this is serious or not. Immutable doesn't mean you can't change data, it means you can't change a variable that has already been assigned in most languages. Everyone here redditors aside can work with mutable state, but I can also work in assembly and choose to work in rust or golang because it allows me to move faster without having to test as many things, same thing with immutable data first, i'm able to move a lot faster without having to worry about mutable state. It's really not that difficult to use immutable data structures and be more efficient than otherwise.
Re:Immutable Data by mrkeen on Monday June 26, 2023 @08:52AM (#36479088)
> I don't want things to change, I simply will not change them, not rely on obscure and irrelevant languages

This gives you the worst of both worlds. It requires programmer discipline, and it prevents non-obscure and relevant languages from reaping any of the benefits of immutability.

Re:Immutable Data by c_crank on Monday June 26, 2023 @10:49AM (#36480314)
Most relevant and non obscure languages support a const feature of some kind.
Re:Immutable Data by mrkeen on Monday June 26, 2023 @11:20AM (#36480839)
It's too little.

There's no language I know of where slapping 'const/final' in front of a field or a function will free you of the burden of considering whether you can safely share it (with the exception of primitives).

If I have a final field of Set<AllowedUsers>, I can't return it, because the caller can insert a new user.

Re:Immutable Data by c_crank on Monday June 26, 2023 @11:30AM (#36481026)
Speaking as someone working in the CRUD Java salt mines, I've never had an issue with sharing variables like this that allegedly makes imperative programming fundamentally broken and unproductive. Scoping and any basically functional program layout does 95% of the work for you.