OT: Programming Expansibility
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 22 11:36:44 PDT 2015
On Thursday, 22 October 2015 at 17:01:55 UTC, Jeffery wrote:
> ... (I don't see how wrapping breaks encapsulation, in fact, it
> adds another layer of encapsulation, which isn't breaking it,
> is it?)
>
>
> The work argument was my whole point though. If the compiler
> internally wrapped all unwrapped members(easy to do as it is
> just a simple forwarding proxy) and D itself can do this with
> just a few lines of code and opDispatch, there is little work
> the programmer actually has to do.
>
> The issue about private wrapping is moot as I mentioned about
> all members being public in the examples. I should have stated
> that in general. Obviously wrapping private members wouldn't
> render the "private" meaningless.
I did not argue that it's a lot of work - I argue that getting
the compiler to do that for you is a bad idea. The point of
encapsulation is that you make a concise choice of which members
to wrap and how to wrap them. The compiler can't make these
design choices, so if the wrapping is done automatically by the
compiler it'll simply wrap everything in a straightforward
manner, and you miss the whole point of the encapsulation.
More information about the Digitalmars-d
mailing list