[gambit-list] As far as the renaming scheme goes, ...

Ken Dickey Ken.Dickey at whidbey.com
Tue Mar 18 10:29:51 EDT 2008


> Arthur Smyles writes:
...
> Ghuloum's library is written in R6 scheme. It works fine out of the box,
> but I had some difficulty in modifying it to export some of Gambit's
> extensions.

You seem to have had an impact.  I noticed that Ghuloum's library has a 
description and example of how to import implementation specific features 
using Gambit as an illustration. 


BTW, one motivation for mentioning R6RS macros is that there is a nice system 
for "breaking hygiene", including creation of gensym'ed temporaries. 

E.g. [from the r6rs-libraries doc]:

(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 ...)))])))

(define-syntax letrec
  (lambda (x)
    (syntax-case x ()
      (( ((i e) ...) b1 b2 ...)
       (with-syntax
           (((t ...) (generate-temporaries #’(i ...))))
         #’(let ((i <undefined>) ...)
             (let ((t e) ...)
               (set! i t) ...
               (let () b1 b2 ...))))))))


Also, it would seem natural to use a "gensym-prefix" which happened to match 
the Gambit namespace prefix of a particular module.   Just a thought..


FYI,
-KenD



More information about the Gambit-list mailing list