Next Prev Up Top Contents Index

top-level-form

Macro
Summary

Use a specified name as a parent name in the specified body of forms.

Note: top-level-form is deprecated. Use def instead.

Package

lispworks

Signature

top-level-form name &body body => result

Arguments

name

The name to use as the parent.

body

The forms across which to use name as the parent.

Values

value

The result of evaluating body .

Description

This macro is useful in the expansion of defining macros. Every form in the body is given name as its parent name. This can be useful for things such as debugging.

top-level-form is exported from the LISPWORKS package.

Example

Compiling the file

(in-package "CL-USER")
(defmacro define-thing (name value)
  `(top-level-form (define-thing ,name)
      (install-thing ',name ,value)))
(defun install-thing (x y)
  (set x y))
(define-thing the-thing 42)
(define-thing some-thing 43)

gives messages such as

; (DEFINE-THING THE-THING)
; (DEFINE-THING SOME-THING)

rather than the more cryptic

; (TOP-LEVEL-FORM 3)

which is the default.

In addition, LispWorks is able to find the source of this form if after typing Meta-. you enter

(define-thing the-thing)

LispWorks Reference Manual - 13 Jun 2003

Next Prev Up Top Contents Index