~ chicken-core (chicken-5) bed246d421d88fa31dc2c92f3a6b3f500d0e4554
commit bed246d421d88fa31dc2c92f3a6b3f500d0e4554 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Thu Mar 25 08:45:02 2010 +0100 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Thu Mar 25 08:45:02 2010 +0100 include-syntax for modules diff --git a/expand.scm b/expand.scm index a64dbb5a..0f51aa29 100644 --- a/expand.scm +++ b/expand.scm @@ -1372,7 +1372,12 @@ ,(if (eq? '* (##sys#strip-syntax (caddr x))) #t (caddr x)) - ,@(cdddr x))))) + ,@(let ((body (cdddr x))) + (if (and (pair? body) + (null? (cdr body)) + (string? (car body))) + `((##core#include ,(car body))) + body)))))) (##sys#extend-macro-environment 'begin-for-syntax diff --git a/manual/Modules and macros b/manual/Modules and macros index 3a7035ae..2c33a089 100644 --- a/manual/Modules and macros +++ b/manual/Modules and macros @@ -240,6 +240,7 @@ CHICKEN's module system has the following features and shortcomings: ==== module <macro>(module NAME (EXPORT ...) BODY ...)</macro><br> +<macro>(module NAME (EXPORT ...) FILENAME)</macro> <macro>(module NAME * BODY ...)</macro> Defines a module with the name {{NAME}}, a set of exported bindings @@ -252,8 +253,11 @@ the toplevel or in other modules. The latter case exports remaining identifiers in the list to be visible in the expansion of the macro (this is a hint to the module expander to export bindings referenced by syntax-definitions which make use of them, but which -would normally be internal to the module - that allows some -optimization and also records). +would normally be internal to the module - which gives more +opportunities for optimization). + +When the {{BODY}} consists of a single string, it is handled +as {{(include FILENAME)}}. Nested modules, modules not at toplevel (i.e. local modules) or mutually recursive modules are not supported. @@ -270,8 +274,11 @@ will export all definitions. Note that the module system is only a device for controlling the mapping of identifiers to value or syntax bindings. Modules do not instantiate separate environments that contain their own bindings, as -do many other module systems. Redefinition of value or syntax bindings -will modify the original, imported definition. +do many other module systems. Redefinition or assignment of value or +syntax bindings will modify the original, imported definition. + +Syntax expansions may result in module-definitions, but must be +at toplevel. ==== exportTrap