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

Re: [Scheme-reports] Location of definitions inside libraries

On Sun, Dec 30, 2012 at 05:37:06PM -0500, John Cowan wrote:
> Christian Stigen Larsen scripsit:
> > are procedure definitions allowed outside of begin-blocks?
> They are, such in programs and at the REPL.
> However, to answer your question as you meant it, they are not allowed
> directly within libraries, and the hello-world example is an unmodified
> survival from R6RS.  I've fixed it and uploaded the new version.

I suppose the confusion here is due to the fact that there are two
separate types of BEGIN.  One is part of the library language, which
consists of only import, export, begin and include (modulo a few others),
and one as part of the Scheme language.

In Scheme, DEFINE can live outside of BEGIN, but in the library
language, there simply is no DEFINE form, so that means it makes no
sense to put DEFINE outside BEGIN.  The library BEGIN form simply is
a "holder" for Scheme code.

It's important to remember that they're really two separate languages
that happen to be covered by the same specification because one is
designed as a "container" for the other.  That they both use BEGIN may
be confusing.  More confusing is that you can rename one to something
completely different.  The other can't be renamed at all, AFAIK.

I hope this clears up some confusion.


Scheme-reports mailing list