From: Jamis Buck Date: 2005-10-06T11:13:30+09:00 Subject: Re: Ruby 1.8.3 breaks Needle's logger? On Oct 5, 2005, at 7:31 PM, NAKAMURA, Hiroshi wrote: > Hi, > > Jamis Buck wrote: > >> Well, to be fair, it was a private API that changed. The problem was > > What is the concept 'private API' here? In general library > development, there are 2 APIs for users and developers. For users > it can be called 'public API' as you wrote. Is 'private API' you > wrote an API for developers who extend a class for implementation > inheritance? By 'private', I meant 'hidden via the private method'. Thus, it was obvious the method(s) being altered were not meant for public (or even programmer) consumption, but given that there was no other way to modify the line format used by the logger than to override the method... well, some of us overrode it. And the signature changed. > Unfortunately Ruby has its small weakness about representing the > latter API. Only we can do is writing a document about it. Logger > has an inline document (by gsinclair: Thanks) but there's no > mention about it because it's a 'final' (Java term) class. > > As a library developer, I wish if I were able to write some > 'protect'-ness and 'final'-ness explicitly (without writing any > document) in Ruby. IIRC Java uses 'final', 'protected' and "This > implementation ..." in Javadoc comments though. > > Anyway, at this time, developers should not do both removing > constants for redefinition and overwriting private methods without > explicit permission by documents if they can. I agree. But in this case, there was no other way to achieve the ends of the programmers. And it was less expensive in the long run (even given the the API change) to override the private method than it was to reimplement Logger with the one line changed. I'm not blaming anyone--the developer of Logger was within their rights to refactor and alter that private method. I just hope (haven't checked yet) that 1.8.3 makes it easier to customize the log format so that moving forward we don't have to mess with Logger's internals. - Jamis