Why is the 'protected' attribute considered useless?

David d at dav1d.de
Wed Jan 30 03:03:41 PST 2013


Am 30.01.2013 04:38, schrieb Chad Joan:
> I've read more than once now that 'protected' is considered useless in
> D.  Why is this?

Tbh, I would consider everything else other than public useless. It's
part of the user to use things according to the documentation and there
are conrnercases where someone wants/needs to do something which was not
intended to do, like accessing an internal value (I had this problem
with std.parallelism at one point). You don't have to force the user to
do everything "correctly" (according to you), it's part of the user to
use your library etc. with care and not limit his possibilities.


More information about the Digitalmars-d-learn mailing list