Re: Visibility

ArtemGr <[email protected]> Sun, 27 Mar 2005 18:20:53 +0400
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
>> That's what I thought you meant.  Fields are, however, definitely
>> attached to classes and are defined that way.  The obvious (for me at
>> least) semantics for private in that situation is to restrict
>> visibility to the enclosing scope.
> 
> However, the question is whether classes define scopes or not. It's 
> equally simple to decide that modules define scopes, not classes. Both 
> choices can be seen as consistent with Java, where (basically) there is 
> only one toplevel class per file/module. And choosing private fields to 
> be only visible inside the class would make it impossible to define some 
> methods outside the class, which does not seem logical in a language 
> with multi-methods (where one can see methods inside classes as a 
> convenience only, not something essential).
> 
> 
> It should also be easier to say that private limits visibility to the 
> module, rather than to distinguish between methods and fields. And for 
> people following closely the "java style" (methods inside classes), they 
> won't even see the difference with Java on this aspect, so it should not 
> be surprising.

If the module is a scope, than it should be natural that module-private 
methods are just invisible outside that scope. There should be no clash 
between foo(I) defined in module "p1.nice" and any other foo(I), becouse 
the first foo(I) belongs to another scope...


-------------------------------------------------------
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