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

Re: put library <body> at top-level

This page is part of the web mail archives of SRFI 83 from before July 7th, 2015. The new archives for SRFI 83 contain all messages, not just those from before July 7th, 2015.

Jens Axel Søgaard wrote:
>  Per Bothner wrote:
>> Tony Garnock-Jones wrote:
>>> - sometimes many small libraries are best expressed in a single file,
>> I think this is fairly rare, and not a very important use case.
>> If they're small, why should they be separate libraries?
>  From a philosphical viewpoint:
>   Since libraries in the context of this srfi is new "languages",
>   a small library is needed to specify a language that differ
>   only slightly from an existing language.
>  From a practical viewpoint:
>   During initial development, it is very practical to have
>   all code in a single file, divided into seperate libraries.
>   When the size of the code grows, it becomes practical
>   to put the libraries in seperate files.
>   Since "wrapper" libraries are common (for, say, renaming a
>   function, restricting the exports, adding error checks etc),
>   small libraries occur often and should be easy to write and
>   test.

Clearly there is no loss of functionality in requiring each library
to be in a separate file (as long we can't nest libraries).

So allowing multiple small libraries is question of convenience in
some cases.  You have to balance this against other factors of
convenience.  The main factor is how the implementation and the
user can *find* a library.  If library-name == URI, then
finding and installing libraries is very easy for both computers
and humans.  If a "file" contains multiple libraries then a
more complicated mechanism must be used.

The specification seems to require some kind of active "install"
concept, to install a file containing a collection of libraries
into a "database" before the library can be imported.  If
instead we have library-name == URI, then "installing" a library
is a more passive concept of just making it in its proper location
in the search-path.

There are other convenience factors, such as the syntactic issue
of having definition in a library <body> not be nested, which
makes it easier to move existig code into libraries.
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/