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

macros expanding into definitions



Personally, I would favor a semantics for internal definitions that is
closer to toplevel definitions:

1) Definitions are evaluated in order.
2) They can be intermixed with non-definitions.
3) A redefinition of a variable is legal and equivalent to a set!

Thus the following would be legal

(define (test)

  (define pi 3.1415)
  (define (get-pi) pi)
  (define (even? x) (or (zero? x) (not (odd? x))))

  (write (list 'pi 'is (get-pi))) ; writes "(pi is 3.1415)"

  (define (odd? x) (not (even? (- x 1))))
  (define pi 3)

  (even? (get-pi))) ; returns #f because get-pi returns 3

This would make your define-multiple (and several other macros) easier
to write.

I'm not saying I agree with the way toplevel definitions behave... I'm
just saying internal definitions should behave similarly.

Marc