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

Re: implementation of SRFI 96 for Larceny



Will Clinger has successfully ported SRFI-96 and SLIB to Larceny.
Some of his comments in
http://larceny.ccs.neu.edu/larceny-trac/browser/trunk/larceny_src/lib/SRFI/srfi-96.sch
are relevant to SRFI-96.

 | ; FIXME:  This should really be ".sch", but then SLIB wouldn't work.
 | (define (scheme-file-suffix) ".scm")

scheme-file-suffix would have been more appropriately named
slib-source-file-suffix.  It is specific to SLIB files.

 | ;;; FIXME:
 | ;;; SLIB appears to need these things, even though SRFI 96 doesn't
 | ;;; specify them or indicate that implementations of SRFI 96 must
 | ;;; define them.
 | 
 | (define (macro:eval . args) (apply slib:eval args))
 | (define (macro:load . args) (apply load args))

That was true of the first version of SRFI-96, and has been rectified.

 | ;;; FIXME:  With Larceny's implementation of defmacro,
 | ;;; macros that have been defined using defmacro are
 | ;;; indistinguishable from macros that have been defined
 | ;;; using Larceny's low-level explicit-renaming facility.
 | ;;;
 | ;;; For SLIB, however, it's probably good enough to pretend
 | ;;; that all low-level macros were defined using defmacro.
 | ;;;
 | ;;; FIXME:  This is terribly representation-dependent,
 | ;;; and will break when (not if) the representation of
 | ;;; macros changes.
 | 
 | (define (defmacro? m)
 |   (let ((x (environment-get-macro (interaction-environment) m)))
 |     (and x (procedure? (cadr x)))))

I will remove defmacro? from SRFI-96.

 | ;;; FIXME:  The specification of defmacro:eval says it
 | ;;; has to use slib:eval, but the definition of
 | ;;; defmacro:load says no such thing.
 | 
 | (define defmacro:load load)

I will change the wording for defmacro:eval to mirror slib:eval
instead of referring to it.

  Function: defmacro:eval e
    Returns the value of evaluating scheme expression e where all its
    defmacros have been expanded.

 | ;;; FIXME:  There doesn't seem to be any analogue of
 | ;;; macroexpand-1 in Larceny.
 | 
 | (define (macroexpand-1 e) (macro-expand e))

macroexpand-1 is a Common-Lisp legacy which I think was useful for
debugging defmacros, but which doesn't need to be supported.  I will
remove it from SRFI-96.

I have added an explanation of the relationship between macroexpand
and defmacro:expand*.

I have uploaded the updated srfi-96.html to:
http://swiss.csail.mit.edu/~jaffer/srfi/srfi-96.html