Is defining get/set methods for every field overkill?


Tue Nov 22 23:38:02 UTC 2022


On Tuesday, 22 November 2022 at 10:10:48 UTC, Sergey wrote:
> ..
> I saw some posts at forum about private-class-scope, but 
> community of core-D is fine with module-unit approach I think.

That's fair enough. I fully support 'majority rules' (if that's 
what's happening here).

But it could limit the uptake of the langauge, particulary for 
those software engineers who believe that when you are defining a 
class, you are defining a type - as Scott Myers has put it.

To such people, other code in the module shouldn't affect my 
type, in the same way it shouldn't affect a built-in type. At 
least, not unless I've authorised it, as part of the 
specification of my type, which presumably I have, by default, 
just by including any other code in a module, where a class type 
has been defined.

In such a module, one should annotate the class with 
@hereBeDragons



More information about the Digitalmars-d-learn mailing list