In the OneSpace Modeling FAQ pages, I sometimes
used or still use the term "macro" for the code snippets which I present there.
Not a wise choice, as it occurred to me a while ago, and I intend to fix that
now, or at least over time as I revisit those pages for other updates.
I used "macro" mostly for historical reasons. "Macro" is an overloaded
term which can mean (too) many things:
- In Lisp, a macro is a piece of code defined by
defmacro. Macros
in Lisp are a clever way to extend the language. If you want to
learn more about this (or about Common Lisp in general, in fact), I recommend
Peter Seibel's "Practical Common Lisp" - here's
the section on macros.
- CoCreate's 2D package, OneSpace Drafting, has a built-in macro
interpreter which can be used to customize and extend the product. Since many
OneSpace Drafting migrate from 2D to 3D, i.e. to OneSpace Modeling,
they tend to take their nomenclature with them, and so they often call
pieces of Lisp customization code a "macro", too.
- In many software packages, users can record the interaction with the product
and save the result into files, which are then often called macro files.
OneSpace Modeling's recorder is such a mechanism, and so using
the word "macro" is kind of natural for many users.
And so many users of OneSpace Modeling call their Lisp functions and
customizations "macros", although this isn't really the correct term. Well,
at least in most cases. Many of those customizations use an API called
sd-defdialog
which is provided by the "Integration Kit" library which
ships with OneSpace Modeling. This API is, in fact, implemented
using
defmacro
, i.e.
sd-defdialog
is itself a Lisp macro. So if a user
writes code which builds on
sd-defdialog
and then calls the result a macro,
he's actually not
that far from the truth - although, of course, still
incorrect.
Previous month: Click
here.
--
ClausBrod - 01 May 2007
to top