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

Translator



I agree with everything which has been said on this subject so far, with
one minor quibble:

    Date: Sat, 15 Sep 90 14:41 EDT
    From: RWK@fuji.ila.com (Robert W. Kerns)

    That's why I usually write defining forms which do something like
    this:

    (defmacro define-rewrite (name arglist &body body)
      (let ((rewrite-fun (gensymbol name "-REWRITE")))
	`(progn (defun ,rewrite-fun ,arglist ,@body)
		(add-rewrite-fun ',name #',rewrite-fun))))

I use SYS:MULTIPLE-DEFINITION instead of PROGN whenever I'm not worried
about portability; this allows the debugger/editor to find the function
when you use c-E from the debugger or m-. in the editor:

(defmacro define-rewrite (name arglist &body body)
  (let ((rewrite-fun (gensymbol name "-REWRITE")))
    `(sys:multiple-definition ,name define-rewrite
	(defun ,rewrite-fun ,arglist
	  ,@body) 
	(add-rewrite-fun ',name #',rewrite-fun))))

If you want this to be portable Common Lisp, you can do the following:

(defmacro define-group (name type &body body)

  #+Genera `(sys:multiple-definition ,name ,type ,@body)

  #-Genera (declare (ignore name type))
  #-Genera `(progn ,@body))

and then use DEFINE-GROUP in place of SYS:MULTIPLE-DEFINITION above.

[Watch out!  SYS:MULTIPLE-DEFINITION has a bug such that you cannot
define a flavor and method(s) on that flavor within a single definition
form.  Use PROGN to separate out the flavor definition from the methods.
I believe this works adequately for Genera CLOS, but I have not tried
it.]