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

where define is legal

   Date: 20 Apr 89 15:54:43 EDT (Thu)
   From: alms@spt.entity.com (andrew lm shalit)

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

   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.

There is nothing in section 5 that could allow one to deduce that
definitions are permitted anywhere other than at top level or at the
beginning of a lambda, let, etc. body.  And the expression you have
written isn't generated by the grammar of section 7.1, since (define
...) is never an <expression>.

Some implementations do permit DEFINE forms in other places, but those
implementations are extending the language.