redscript
redscript copied to clipboard
Private visibility of method not honored in subclass
I accidentally left a private
modifier on a method that is added to an existing CP77 class, this method is then called by its subclasses. To my surprise this works, although the visibility should be at least protected
(at least by my assumption).
Visibility has never been enforced on accessing class members, because initially, when building the compiler I realized that it severely limited what kinds of mods could be written without accessing bits of the game that were made private by CDPR. I've been considering to include some opt-in mechanism to enable visibility enforcement for your own classes, but it's not been added yet - the only visibility that is currently enforced is for module imports/exports.
We can keep this issue as an enhancement (addition of an opt-in visibility enforcement for class members).
Thanks, makes sense.
The opt-in enforcement for user types sounds great.