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

Re: initforms and implicit blocks



	
    Date: Thu, 6 Mar 86 17:18:28 EST 
    From: apollo!dfm@uw-beaver.arpa
    To: COMMON-LISP@su-ai.arpa
    Subject: initforms and implicit blocks
    Message-ID: <8603070500.AA16622@uw-beaver.arpa>
    
    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?
    
	(block f                                           
	  (labels ((f (&optional (x (return-from f nil)))))
	    (f)                                            
	    t) )                                           
    
    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
construct..."

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.

	-- Nick