[pro] Generated symbols

Pascal J. Bourguignon pjb at informatimago.com
Sun Jul 3 11:11:26 UTC 2011


Kazimir Majorinc <kazimir at chem.pmf.hr>
writes:

> I need comprehensive review of use of generated symbols (make-symbol,
> copy-symbol, gensym... ) in CL. The books I have (both Grahams,
> Siebel, barely mention these operators, except for use of gensym in
> macros.
>
> What are other typical or interesting uses of these?

The most typical use, is a defstruct like macro, which derivates
"public" names from a base name.


   (DEFSTRUCT COLOR RED GREEN BLUE)

generates function definitions for:

   MAKE-COLOR COLOR-P COPY-COLOR COLOR-RED COLOR-GREEN COLOR-BLUE


Ask yourself, what should:

   (DEFSTRUCT other-package:|color| |Red| other-package:|GREEN| |blue|)

generate?

(And the effect *print-case* should or should not have on that...)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.





More information about the pro mailing list