Re: Is this a bug?

Tom Kaitchuck <[email protected]> Fri, 2 Sep 2005 16:12:47 -0500
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
On Friday 02 September 2005 1:39 pm, James Reeves wrote:
> 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?

Yes, it would seem to me that Protected in nice should mean something like 
"Can only be accessed within functions that are in the same file as a class 
that inherits from a class defined in the file where this function is 
defined."

This would have the advantage of maintaining java compatibility, if being a 
little generous.


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