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

where define is legal

Offhand, the following definition seems bogus:

(define (foo bool)
  (if bool
      (define (result) #true)
      (define (result) #false))

And indeed, when I try to run this in MacScheme, I get an error message.

I agree with the semantics, but I couldn't find anything in the R3
description of DEFINE which restricts where it may appear.

Some people from non-scheme backgrounds might think programmatic DEFINEs
perfectly reasonable, so it's probably worth mentioning the restriction
in the language description.