From: Raymond Toy on
On 4/6/10 10:38 AM, Ron Garret wrote:
> In article <87k4skslja.fsf(a)hangup.portland.xach.com>,
> Zach Beane <xach(a)xach.com> wrote:
>
>> Ron Garret <rNOSPAMon(a)flownet.com> writes:
>>
>>> you should NEVER use #: because it breaks READ-READ consistency (see
>>> CLHS 2.3.6). If you need an uninterened symbol with a particular name
>>> you should call MAKE-SYMBOL directly to make it clear what is going
>>> on.
>>
>> For DEFPACKAGE, IN-PACKAGE, ASDF:DEFSYSTEM, etc., the uninterned symbol
>> is used only for the string it designates, and it is not evaluated.
>
> Yes, but in those cases you don't need uninterned symbols. Keywords
> work just fine. In fact, that is what keywords are for.

Why is cluttering up the keyword package with symbols better than
cluttering up some other package with random symbols?

Ray
From: RG on
In article <p7GdnZa0ZMLS-ibWnZ2dnUVZ_t-pnZ2d(a)earthlink.com>,
Raymond Toy <toy.raymond(a)gmail.com> wrote:

> On 4/6/10 10:38 AM, Ron Garret wrote:
> > In article <87k4skslja.fsf(a)hangup.portland.xach.com>,
> > Zach Beane <xach(a)xach.com> wrote:
> >
> >> Ron Garret <rNOSPAMon(a)flownet.com> writes:
> >>
> >>> you should NEVER use #: because it breaks READ-READ consistency (see
> >>> CLHS 2.3.6). If you need an uninterened symbol with a particular name
> >>> you should call MAKE-SYMBOL directly to make it clear what is going
> >>> on.
> >>
> >> For DEFPACKAGE, IN-PACKAGE, ASDF:DEFSYSTEM, etc., the uninterned symbol
> >> is used only for the string it designates, and it is not evaluated.
> >
> > Yes, but in those cases you don't need uninterned symbols. Keywords
> > work just fine. In fact, that is what keywords are for.
>
> Why is cluttering up the keyword package with symbols better than
> cluttering up some other package with random symbols?

Because the main problem with having extra symbols in a package that you
don't want, namely symbol conflicts, tends not to arise because of the
constraints on the keyword package and the usage conventions that result
from those constraints. You can't bind keywords, and you can't USE the
keyword package. Because of this, people tend not to import keywords
into other packages nor do they tend to import symbols from other
packages into the keyword package (though both are legal AFAICT). So
the only negative consequences of having extra symbols in the keyword
package under normal use is a little extra memory being used and some
extraneous output from APROPOS.

rg
From: Zach Beane on
RG <rNOSPAMon(a)flownet.com> writes:

> So the only negative consequences of having extra symbols in the
> keyword package under normal use is a little extra memory being used
> and some extraneous output from APROPOS.

These negative consequences aren't present when using an uninterned
symbol in certain places, like the ones Tamas mentioned in his original
post.

Zach
From: Pillsy on
On Apr 6, 11:14 am, Ron Garret <rNOSPA...(a)flownet.com> wrote:

> In article
> <a06fc1e0-aa10-43f3-bd8c-d52032178...(a)5g2000yqj.googlegroups.com>,
>  Pillsy <pillsb...(a)gmail.com> wrote:

> > On Apr 6, 5:31 am, Tamas K Papp <tkp...(a)gmail.com> wrote:
[...]
> > Another place I'll use them is when I'm using format to build interned
> > symbols in macros. For example, I'll often have things like

> >     (defmacro deffrob (name &body stuff)
> >       `(progn
> >          (defun ,(intern (format nil "~A~A" '#:make name)) ()
> >            ...

> > Again, this is more habit than anything else.

> That's a pretty bad habit.

I don't see why it's worse than the other options.

> Why not:

> (format nil "~A~A" :make name)

Because having a lot of random symbols in the KEYWORD package can be
annoying.

(defun make-gadget (&key widget gizmo) ...)

(defmacro def-widget-accessors (&rest widget-slots)
(progn
,@(mapcar (lambda (slot)
`(defun ,(intern (format nil "~A~A" :widget- slot)
(widget)
(get-widget-slot widget ',slot)))
widget-slots))

Having a keyword like :WIDGET- is something that gets old pretty fast
when you use symbol completion in SLIME.

> or

> (format nil "~A~A" "MAKE" name)

> or

> (format nil "MAKE~A" name)

I don't really like all-caps strings on aesthetic grounds, and it only
saves me a keystroke relative to the uninterned symbol.

These aren't overwhelming reasons, obviously, but neither are the
reasons to do the opposite that I've seen.

Cheers,
Pillsy
From: Barry Margolin on
In article <hpfj70$v7r$1(a)news.eternal-september.org>,
Tim Bradshaw <tfb(a)tfeb.org> wrote:

> On 2010-04-06 15:38:00 +0100, Ron Garret said:
> >
> > Yes, but in those cases you don't need uninterned symbols. Keywords
> > work just fine. In fact, that is what keywords are for.
>
> Some people don't like interning a large number of symbols they don't
> need for things like package export lists and so on.

If DEFPACKAGE is implemented well, the symbols should only be interned
at compile time, and not make it into the FASL file.

My opinion is that #: was created primarily to be used as an *output*
syntax, so that uninterned symbols in macro expansions would be
recognizable. Back in the Maclisp days, we simply knew that symbol
names of the form G##### were gensyms, but that was an unsatisfying
kludge. Once we had the package system and colon syntax, it was pretty
obvious to use something along those lines to indicate uninterned
symbols as well. This then made it reasonable to use MAKE-SYMBOL rather
than GENSYM to put more mnemonic symbols in macro expansions.

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***