Sealed classes - would you want them in D? (v2)
KingJoffrey
KingJoffrey at KingJoffrey.com
Thu May 17 02:32:07 UTC 2018
I propose an idea, for discussion (robust discussion even better
;-)
Add an new attribute to class, named 'sealed'.
No, not sealed as in Scala.
No, not sealed as in C#
sealed as in oxford dictionary (close securely, non-porous).
when sealed is applied on the class, this means the class is
sealed.
the sealed attribute only makes sense within a module, and
affects nothing outside of the module.
When sealed is applied to the class, then, interfacing to a class
within a module, from code outside that class - but still within
the module, can now only occur via the published interface of the
class.
outside code in the module, can no longer directly access your
private parts!
The class is sealed.
More information about the Digitalmars-d
mailing list