Discussion:
Generated symbols
Kazimir Majorinc
2011-07-03 01:59:25 UTC
Permalink
Content preview: 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. [...]

Content analysis details: (0.7 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no
trust
[195.29.150.135 listed in list.dnswl.org]
0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral)
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/483>

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?

--
Kazimir Majorinc
Pascal J. Bourguignon
2011-07-03 11:11:26 UTC
Permalink
Content preview: Kazimir Majorinc <kazimir-***@public.gmane.org> 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? [...]

Content analysis details: (-2.3 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium
trust
[80.91.229.12 listed in list.dnswl.org]
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
domain
-0.0 SPF_PASS SPF: sender matches SPF record
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/484>
Post by Kazimir Majorinc
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 {}.
Daniel Weinreb
2011-07-04 13:35:43 UTC
Permalink
And if you ever wondered why CLOS makes you spell
out the names of readers and accessors, this is why.
CLOS does not want to make any assumptions about
how you want to make decisions about what
packages things are in.

It's the "right thing" rather than the "worse is better"
way, with all the usual issues. In our own code,
we have a "define-class" macro that defines
all accessors automatically, interning them in
the package that makes sense for us. It's kind
of a middle path between defstruct and defclass.
I don't love it but I don't hate it...

-- Dan
Post by Pascal J. Bourguignon
Post by Kazimir Majorinc
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)
MAKE-COLOR COLOR-P COPY-COLOR COLOR-RED COLOR-GREEN COLOR-BLUE
(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 {}.
_______________________________________________
pro mailing list
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro
Continue reading on narkive:
Loading...