[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: initforms and implicit blocks
- To: apollo!dfm@UW-BEAVER.ARPA
- Subject: Re: initforms and implicit blocks
- From: NGALL@G.BBN.COM
- Date: Fri, 07 Mar 1986 14:32:00 -0000
- Cc: COMMON-LISP@SU-AI.ARPA
- In-reply-to: <8603070500.AA16622@uw-beaver.arpa>
- Sender: NGALL@G.BBN.COM
Date: Thu, 6 Mar 86 17:18:28 EST
Subject: initforms and implicit blocks
Apologies if this has been discussed before.
Are initforms in &optional, &key, and &aux parameters evaluated inside or
outside the implicit block provided by defun and friends? In particular,
should the following return t or nil?
(labels ((f (&optional (x (return-from f nil)))))
As near as I can tell CLtL is silent on this. Perhaps it simply "is an error"
to depend on either behavior? At first glance, it seems most tasteful to have
them evaluated within the implicit block.
- Don Morrison
On pg 67:
"The FORMS constitute the body of the defined function..."
"The body of the defined function is implicitly enclosed in a BLOCK
I think this strongly implies that the init forms are not enclosed by the
BLOCK, since they are not part of the body by this definition. Since this
definition of body is somewhat at odds with the definition of body used
in the DECL. chapter (pg 155), the fact that init forms are not
enclosed in the block should be made explicit.
Of course, I would prefer that init forms were considered part of the
body in all contexts (hence one could do returns in them), but I think
most implementations have already done it the easy way.