Elektrine lite

← Feed

@Ephera@lemmy.ml

2026-10-25 03:41 UTC

Moreso correctness, not security. In the end, your user is shooting themselves in their foot, if they mutate a variable that they shouldn’t, and by making the variable private and only offering a getter, we document that. Having said that, there’s also big differences between languages and paradigms, though. In object-oriented / garbage-collected languages, you often pass around references to an object into so many places that you need to code defensively versus your own codebase. That’s why getters/setters were taught religiously during the height of OOP. In other paradigms, you often just have one place that uses an object and then you can …simply not shoot yourself in the foot there. When you control both the definition and the access, you don’t need to protect yourself from yourself. In particular, if you think twice before you start mutating things, just in general.

Replies (1)

  • @klankin@piefed.ca 2026-10-25 13:38

    Damn, I was gonna disagree but you bring up some good points. I really need to get into functional programming.

    Open ##5240015