question/suggestion about protection attributes

Sergey Gromov snake.scaly at gmail.com
Wed Dec 23 06:20:23 PST 2009


Rainer Deyke wrote:
> Zarathustra wrote:
>> Why protection attributes aren't divided into two groups?
> 
> ...  Because there is no valid
> reason for protecting fields from functions in the same module...

Encapsulation anyone?  If you pack related functionality into a single 
module you don't have *any* means of enforcing encapsulation at the 
language level.  "private" becomes a pure convention.  And if you use 
modules to systematically enforce encapsulation you end up with Tango: 
dozens of micro-modules which require either dozens of imports to use 
them, or ugly collective import modules which require constant attention 
and maintenance.



More information about the Digitalmars-d mailing list