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

Re: [Scheme-reports] General comments on the draft WG1 R7 report.



Jay Reynolds Freeman scripsit:

> ("Permanence" is useful because my Schemes implement most of the
> standard Scheme syntactical constructs (if, cond, let, let*, letrec
> ...) using the hygienic macro system, and code would run very, very
> slowly if the evaluator had to expand every such macro every time it
> encountered it.

There is a ticket not yet voted on that would require this behavior for
all syntax, whether user-defined or not.  Currently, at least 20 Schemes
conform to this, with the exception of SCM which expands macros when
code in a definition is run, and then leaves them expanded.

Thus, if you type at the REPL:

(define-syntax foodle
  (syntax-rules ()
    ((noodle) 23)))

(define (noodle) (foodle))

(define-syntax foodle
  (syntax-rules ()
    ((noodle) 47)))

then (noodle) must evaluate to 23.  Currently SCM will return 47 unless
you interject a call to noodle before foodle is redefined, in which case
the use of foodle will be expanded, and noodle will return 23 thereafter
no matter how many times you redefine foodle.  All the other Schemes
I track (Racket, Gauche, MIT, Gambit, Chicken, Bigloo, Scheme48/scsh,
Guile, Kawa, SISC, Chibi, Chez, IronScheme, Ikarus, Larceny, Ypsilon,
Mosh, STklos, SigScheme, Scheme 9) return 23 in all cases.

> The standard Scheme procedures are similarly made permanent so that
> compiled code can include direct references to the routines that
> implement them rather than having to look up the binding of, e.g.,
> "car" every time.  (A user who wishes, e.g., to change the meaning
> of, e.g., "car", can remove its permanent status and install a new
> definition.  Uncompiled code will see the new definition at once, but
> any code that was compiled while the old, permanent one was in effect
> will need to be recompiled if the intent is to use the new one.))

This should be added to the ticket.

> This discussion may yet be productive if we identify circumstances
> in which care is required to specify the intended behavior of forms
> evaluated in an interpreter, as opposed to in an implementation with
> true separate compilation.

I think it's the other way about: care must be taken to ensure that
compiler implementations can do what they need to.

-- 
John Cowan  cowan@x  http://ccil.org/~cowan
The competent programmer is fully aware of the strictly limited size of his own
skull; therefore he approaches the programming task in full humility, and among
other things he avoids clever tricks like the plague.  --Edsger Dijkstra

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