If anybody has strong objections, we need to hear them!

The current specification states that the identifier(s) on the left-hand
side of DEFINE are incomplete until the body of the DEFINE has been
processed.

This definition is necessary for the type-defining keywords, but it is
inconsistent with the way that other languages specify identifier
binding. In particular, in 

  (let ((ast (f ast))) ...)

the /ast/ on the RHS is the one from the environment that *encloses* the
LET form.

I want to revise the definition of DEFINE to match the current
definition of LET, which states:

  The environment in which the expression(s) are evaluated does not
  contain the identifiers being bound in the current let form.

Note that I have already updated the derived from rewrite for the
syntactic sugar (define (f [args]) body) to be defined in terms of a
LETREC rewrite. If you use the sugared form, the letrec will be inserted
for you. If you don't, and you need recursion, it's your job to
introduce the required LETREC form.

Note in particular that this changes how the mutually recursive odd/even
example need to be defined in a single definition:

(define (odd,even)
  (letrec ((odd (lambda (x) (cond ((< x 0) (odd (- 0 x)))
                                  ((== x 0) #f)
                                  (otherwise (even (- x 1)))))
           (even (lambda (x) (cond ((< x 0) (even (- 0 x))
                                   ((== x 0) #t)
                                   (otherwise (odd (- x 1))))))
    (odd, even)))

But in practical terms, this sort of mutual recursion should turn out to
be the *only* place where the required input changes, and it is a rare
enough case that I don't really care very much about it.


Reactions? Objections?


shap

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to