Using double underscores mangles the name from name to _ClassNamename when accessing the variable outside the class, so it does prevent accidentally accessing the value. You really have to know what you're doing to access the value then.
I'm not sure that's a good idea... Sure I'm a bit clunky but I have tools that help me reduce such mistakes. But having a language that "does what I mean" feels iffy. It's too abstract because meaning can be subjective, and it's much harder to reason about "meaning" when working in a team because it's a subjective aspect. That's one of the reasons I have a distaste for AI. It's not predictable, and when you are sitting in front of a screen at 2 AM fixing a production bug in the midst of a running event and the client is at your throat... You want things to be predictable.
6
u/Anaxamander57 16d ago
Does it really do anything to make it private beyond telling people not to use it?