This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to String.intern


>> I'd prefer not to do this, since to me it seems uglier.  I prefer
>> not to use functions that aren't attached to a class.

Per> Why?  If a function is local to a file, why not just keep it
Per> local to the file?  What good is making it a method - it just
Per> clutters up String.java and String.h and the String Class object
Per> for no reason at all.

I prefer it because I think the unit of encapsulation is the class and
not the file.  On occasion I've had to change a static function into a
static method in order to access private class data -- using `friend'
is just ugly.

In this particular case I agree it isn't super-critical.  Go ahead and
change it if you want.  We probably won't have to change it back.

>> Also, pointer-to-member isn't an issue for a static method.

Per> That I think is an C++ implementation issue.

According to "The C++ Programming Language, 3rd Edition" by
Stroustrup, section 15.5 "Pointers to Members":

    A static member isn't associated with a particular object, so a
    pointer to a static member is simply an ordinary pointer.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]