[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Language and library



Dan Weinreb wrote:
> 
>...
> 
> Java's collection classes are universally referred to by Java people
> as being part of the libraries, whereas the basic Common Lisp
> collection stuff is always referred to as being "in the language"
> (since they're documented right there in the language reference
> manual). But technically, the distinction seems pretty arbitrary.
> In that sense, I think the distinction can be blurry.

Whether or not it is clear, the libraries make a huge difference in the
lighweightness of a "distribution". When I do anything file or string
related in Java, I just grit my teeth. Unless I am missing something
obvious, this is the canonical way to do a very primitive form of
globbing in Java:

    public static FilenameFilter 
        filter(final String extension) {
            // Creation of anonymous inner class:
        return new FilenameFilter() {
            String fn = afn;
            public boolean accept(File dir, String n) {
                // Strip path information:
                String f = new File(n).getName();
                return f.endswith(extension) != -1;
            }
        }; // End of anonymous inner class
    }

versus: 'glob.glob("foo")' in Python (or even shorter in Perl!).

Sure, I can find a glob library on the web, but as soon as I'm searching
the Web for basic stuff, the language has lost any claim of
lightweightness. It is interesting how much effort goes into J2EE
frameworks and so forth while basic stuff like this is so painful. 

 Paul Prescod