[pro] [Q] naming convention
Pascal J. Bourguignon
pjb at informatimago.com
Thu Apr 5 00:15:16 UTC 2012
Didier Verna <didier at lrde.epita.fr> writes:
> I have a FROB functionality that I would like to make available both at
> run-time via a function and at compile-time via a macro (which in turn
> will call the function).
>
> Are there any general conventions (apart from DEFINE- / MAKE-) for this
> kind of thing ? I'm having a hard time finding nice names for FROB the
> function and FROB the macro...
DEF or DEFINE- and MAKE- are used in CL (eg. DEFPACKAGE and
MAKE-PACKAGE).
If the macros are just a wrapping of the functions for compilation-time
invocation, their names may vary only by one *.
For example in my HTML generator package, the element macros are named
after the tag, and the element functions after the tag*.
(defun p* (…) …)
(defmacro p (…) (p* …)
In this case, I assume clients of the package will use the macro in
general (p compilation-time-data) but they may also need to call the
function at run-time (mapcar (function p*) …) or just (p* run-time-data).
For a single functionality, DEFINE-FROB and MAKE-FROM sound good.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
More information about the pro
mailing list