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

Does Defmacro establish a block?

    Date: Tue, 11 Jun 1985  21:17 EDT
    From: "Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>

	    If defmacro does, do define-setf-method, defsetf, deftype...?

	I believe that all defining forms that have a name and a body should put
	a named block around the body.  In our implementation, defun and defmacro
	do so, but currently the others you mentioned do not.  I'm calling that
	a bug in our implementation and suggesting that a future clarification
	of Common Lisp should require this.

    I can accept this, but let's be sure we agree on what the block name
    would be in each case.  For the SETF forms, is it the name of the
    accessing operator?  For DEFTYPE, is it the name of the type?

Yes.  I propose this rule: In any DEFxxx form that has a body that is code to
executed, then if CADR of the form is a symbol, then a BLOCK with that symbol
as its name is automatically wrapped around the body in such a place that
RETURN-FROM that block is the same as making the body evaluate to the returned
value.  The complicated language here is to deal with the case where the 
form expands into a large bunch of code with the user-supplied body buried
somewhere inside it.