`restricted` member variables
Paul Backus
snarwin at gmail.com
Thu Jun 23 00:48:13 UTC 2022
On Thursday, 23 June 2022 at 00:20:20 UTC, forkit wrote:
> private(this) enables data hiding *within* a module.
>
> you now have the tool needed to define an abstract data type
> *within* a module.
[...]
> I fail to see the downside (providing the syntax fits in well
> with the rest of the language, and doesn't stand out like a
> sore thumb).
>
> once it's in, people will use it, or not, and all this fuss
> will be long forgotten....
The downside, as with every new language feature, is the cost of
implementation and maintenance, plus the opportunity cost of
adding new features instead of working on polishing existing ones.
I freely acknowledge that private(this) has non-zero upside. It
makes the language more expressive. That, by itself, is not
enough to justify the addition of a new language feature.
In order for private(this) to be added to D, somebody must
convince Walter and Atila that the expected upside of it is large
enough to outweigh the downside inherent to adding *any* new
language feature.
This is why people are asking for concrete examples, and are not
satisfied with theoretical justifications alone. They don't just
want to hear that private(this) *could* be useful; they want to
be convinced that it *will* be useful, in practice.
More information about the Digitalmars-d
mailing list