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

a counter proposal



To use the proposed read-time evaluation in a program the program
would have to be in two parts.  The first part defines the read-time
constructors and then loads a file containing the second part.  The
second part can use `#,' to call constructors defined in the first
part.  This is a very clumsy mechanism.  I could get the same effect
in vanilla R5RS, with much more power and flexibility, by using EVAL
and an extensible reader:

  (define my-reader (make-reader ...))

  (eval (my-reader filename) some-environment)

This two-phase evaluation is unnecessary.  Using `#,' in a program
has two effects: it causes side effects to occur at read time and it
ensures that a form is evaluated only once.  The first has questionable
utility and semantics.  The second is already available in R5RS as
`delay' and `force'.  The only thing missing is a concise notation.
Why not have

  #,(...)

read as

  (force (delay (...)))

just as `(...) reads as (quasiquote ...)?  This avoids the need to
preregister constructors and it preserves the separation between
syntax and semantics.  A program can be evaluated in one fell swoop.

                                      -Richard Kelsey.