Re: Is this a bug?

James Reeves <[email protected]> Fri, 2 Sep 2005 19:39:35 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
On Friday 02 Sep 2005 10:19, Daniel Bonniot wrote:
> > If so, is there anything akin to a "protected" keyword in Nice?
>
> Not at the moment. How would it be defined? (keep in mind that
> multi-methods do not "belong" to classes)

In Java, protected methods in a class can be accessed in classes that inherit 
from that class, but not from methods outside said class.

In Nice, private methods in a class can be accessed in classes that inherit 
from that class, but only if both classes are defined in the same file.

So if one wanted a protected method in Nice, one would have to have all 
derivative classes stored in the same file. This strikes me as a little 
inflexible, and could result in large files where the programmer is forced to 
put many classes in one file.

Have I misunderstood something? If I have 10 classes, B through K, inheriting 
from a single class A, and referencing private methods in A, does that mean 
that I have no choice but to put classes A through to K in a single .nice 
file?

Isn't this a problem that could be solved with something akin to Java's 
protected keyword, or with an expansion of the private keyword?

--
James Reeves
http://www.monkeyengines.co.uk/


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf