D

Janderson ask at me.com
Sat Nov 15 15:46:04 PST 2008


Walter Bright wrote:
> Tim M wrote:
>> I think you're thinking of Java. Those guys are shit scared of public 
>> properties. Get & Set for everything.
> 
> I never really understood the fear of that, either.

One problem is that once you make something public its difficult to make 
it private or move it to another class without impacting the client who 
uses the code.  Its difficult if you decide to Pimpl something for 
example.  D of course allows one to write their own Getter/Setters so 
that's a non issue.

Of course if your writing something like a simple struct (ie 
non-invariant) then your not likely to want to encapsulate it any way. 
It's a pity Java doesn't have a concept of struct.

-Joel



More information about the Digitalmars-d mailing list