Am So., 27. Sept. 2020 um 21:32 Uhr schrieb John Cowan <xxxxxx@ccil.org>: > > I agree that r6rs libraries are the Right Thing for Guile, and neither native modules nor R7RS libraries. There is no distinction between include and include-library-declarations in R6RS, as all that is allowed is a single export and a single import (with any number of libraries, of course) and the rest is code. > > If an R6RS doesn't have `include`, it is trivial to package this definition (from R6RS Libraries 12.6 s.v. datum->syntax) in an (include) library: > > (define-syntax include > (lambda (x) > (define read-file > (lambda (fn k) > (let ([p (open-file-input-port fn)]) > (let f ([x (get-datum p)]) > (if (eof-object? x) > (begin (close-port p) '()) > (cons (datum->syntax k x) > (f (get-datum p)))))))) > (syntax-case x () > [(k filename) > (let ([fn (syntax->datum #'filename)]) > (with-syntax ([(exp ...) > (read-file fn #'k)]) > #'(begin exp ...)))]))) The power of procedural macros! :) PS The only drawback with this approach is that all source code location information is lost, which can make debugging hard.