Re: Visibility

Daniel Bonniot <[email protected]> Tue, 05 Apr 2005 12:30:41 +0200
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
>  > Since we agree that "private" means visible in the module, then
>  > what is the problem? A private field is visible outside it's
>  > closest "scope" (its class) to the whole module. That's similar to
>  > 'default' being visible outside the module to the whole package.
> 
> Because it's different from what Java calls "private".

It's not different, given that in Java you essentially have one class per 
file.  There might be a difference compared to the case where you define 
several toplevel classes in the same Java source file, but that's so much out 
of practice that I don't think it matters.

If I'm not mistaken, in C++ where member methods can be written outside the 
class and in the same file, member methods can access private fields. So 
that's fairly consistent with the proposed private in Nice.


>  >> Other languages seem to do alright with one file per package.  Perhaps
>  >> thats because they can re-export imported symbols which allows for
>  >> package aggregation, ie., one public package and several internal
>  >> packages.  Nice and Java only provide this implicitly.

By the way, I think it could be useful to have an "export" keyword to 
explicitely re-export imported symbols. One example is "wrapper" libraries 
like NiceSwing that retype and add functionality to existing libraries.

Daniel



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click