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

[Scheme-reports] libraries, cond-expand, begin, and expressions vs definitions



In general the report does not do a great job in distinguishing between
expressions and definitions.  This is somewhat troubling for a report
that defines a new module system, but I think the main problems can be
remedied.

First of all, the clauses of a `cond-expand' outside a define-library
form is specified as containing expressions.  This does not appear to be
the case: they seem to be able to contain definitions as well.

Secondly, and more gravely, it seems that the `begin' expression of the
`define-library' language can contains "commands or definitions"
(5.6.1).  What is a "command"?  I will assume you mean "library
declaration", as mentioned later in the section.  I also assume that
`begin' can contain expressions.  So, the problem: allowing `begin' to
contain library declarations appears to break the "static" intent of the
define-library system.  The point of separating the define-library
language from Scheme was to remove the need to analyze scope to
determine the imports, exports, and code of a library -- but here we
have a problem, because the body of a "begin" is logically scoped
according to the set of imports from the library.

For example:

  (define-library (lib-1)
    (import (except (scheme base) cond-expand))
    (export cond-expand)
    (define cond-expand display))

  (define-library (lib-2)
    (import (lib-1))
    (begin
      (cond-expand ...)))

It can be made to work but I don't think that it is what was intended.

Andy
-- 
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports