This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

interesting behavior of define


This is not a bug report, as the interesting behavior only happens with
non-standard code.  The deftest2 function below puts an internal
definition someplace R5RS section 5.2.2 says it shouldn't.  The
interesting result, however, is that xyz gets defined globally.

(define (deftest1)
  (define abc 1)
  abc)

(define (deftest2)
  (display (define xyz 1))
  xyz)

This came up with BRL when a user made a macro that did definitions.
The brl macro expanded (foo var val) to (display (foo var val)), which
expanded to (display (define var val)), which created a global variable.

Kawa isn't violating any standard to behave this way; it's probably up
to me to figure a way to make this work.  I may make (brl (silent expr
...)) expand to (begin (begin expr ...) ""), since deftest3 gives def
the scope I expect:

(define (deftest3)
  (begin
    (begin
      (define def 1))
    "")
  def)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]