As simple as possible, but no simpler. A large library has many costs. The obvious cost is the code size, but that's the least thing to worry about. Implementers must write, and test, and debug, and document, and maintain all that code. Users must endure long training and voluminous documentation, and inevitably find that the closest function in the library isn't quite what they need, and write their own anyway -- worse, they don't notice that the library does provide exactly what they need, but under a different name, and they write it again, anyway. And how many times have you seen a library that was useful in version 2 but unusable in version 5 because the need to maintain backward compatibility prevented some feature from working the "right" way? If you don't provide a function now, you won't regret having the function later.
It's ultimately a matter of philosophy. Scheme has since its inception favored minimalism. Other languages make other choices. I'm not necessarily saying that streams-ext should be tiny, though I do think smaller is better than larger. I am saying that SRFI-1 is not an appropriate checklist by which to design streams-ext, because it will force you to provide many functions that only make sense for programming with streams-as-lists but not for programming with streams-as-streams. And I think SRFI-41 is, overall, a pretty good library, neither too small nor too large, but mostly just right. And if you need butlast, you should probably be using lists, not streams. On Thu, May 7, 2009 at 9:10 AM, John Cowan <co...@ccil.org> wrote: > Phil Bewig scripsit: > > > The guiding principle in any library must be to keep it small and simple. > I > > quoted Saint-Exupéry in SRFI-41, but could have quoted Einstein > "Everything > > should be as simple as possible, but no simpler." Occam's Razor also > > applies. > > The analogy is false, at least as far as Einstein and Occam are concerned. > They were talking about keeping the number of explanatory principles > small. But tools are not principles. > > The smallest and simplest library for lists in Scheme consists of car, > cdr, cons, pair?, and '(). Would you really be happy in a world where > that's all you get, and the rest is "just part of your program"? When I > ask a builder to construct a house for me, I do not expect him to begin > by cutting down trees, digging clay for bricks, and mining iron ore > for nails and screws. Nor do I expect him to reinvent drywall from > first principles. > > > SRFI-1 and streams-ext violate that principle to their own detriment. > > The point of a library, like that of a tool chest, is to provide tools > considered generally useful. If your tool chest is half-empty, you > wind up pounding nails with a screwdriver, or in the extreme case, > instantiating Greenspun's Tenth Law. Too-simple libraries make > too-complex programs. > > -- > John Cowan http://www.ccil.org/~cowan<http://www.ccil.org/%7Ecowan> > co...@ccil.org > To say that Bilbo's breath was taken away is no description at all. There > are > no words left to express his staggerment, since Men changed the language > that > they learned of elves in the days when all the world was wonderful. --The > Hobbit >
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users