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

Re: function names and warnings



If you look in methods.l, the code generated for the method
functions in EXPAND-DEFMETH-INTERNAL inserts a DECLARE
after the LAMBDA which declares the name of the method to
be a method function name, as:

	(DECLARE (METHOD-FUNCTION-NAME ,<something>))

METHOD-FUNCTION-NAME is not a standard declaration from CLtL.
I would assume, however, most Common Lisp implementations
have a way of naming LAMBDA's, which they use for named
function definition. In HP Lisp, the extension is:

	(DECLARE (EXTN:NAME ,<something>))

I modified my methods.l so it looks something like this:

(defvar *method-name-declaration*
   #-HP 'method-function-name
   #+HP 'extn:name
)

<code for expand-defmeth-internal>

	(declare (,*method-name-declaration* ,<something>))

As to why not just use a DEFUN instead of a LAMBDA, I'm only
guessing, but there are a number of possible reasons. One
is to decrease method definition time by open coding function definition,
another is so that only one block can be established around
the method function with the method name. A DEFUN would establish
an additional block with the generated function name as well.
Depending on the implementation, this could result in code which
was less efficient, and, in any event, semantically incorrect,
since the user could jump out of the method by using the generated
function name.

		Jim Kempf	kempf@hplabs.hp.com