Using closure in function scope to make "real" private class members
forkit
forkit at gmail.com
Sat Jun 4 13:18:23 UTC 2022
On Saturday, 4 June 2022 at 12:28:41 UTC, Mike Parker wrote:
>
> 2) A solution exists for anyone who cares about that conceptual
> difference. We don't need a new keyword/attribute to do
> something you can already do.
>
Umm..no.
Once again, you're rephrasing my argument to suit you're agenda (
of sprouting the 'superior' approach of D).
If I could aready do what i want to do, I would not be discussing
it.
I'd like the option to improve type soundness of a class, so that
I can confidently have other code in the module, and thereby have
the assurance that other code does not violate my class
invariants.
I cannot currently do that in D.
It's a bit like having an invariant near the top of the module,
that says x must not equal 0.
But 85 lines down in the code, someone has set x to 0.
An you're argument would be, hey, just put x in its own module
then.
More information about the Digitalmars-d
mailing list