emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: symbol equality --cl-rest-- help-function-arglist member vs member*


From: MON KEY
Subject: Re: symbol equality --cl-rest-- help-function-arglist member vs member* and also equal, eql, and eq
Date: Tue, 22 Dec 2009 18:57:38 -0500

Stephen
> Apparently --cl-rest-- is an uninterned symbol.  This is done so that
> the symbol cannot shadow an definition in code outside the cl-arglist
> processing module.

Miles
> It looks like `--cl-rest--' is an uninterned symbol.
> This is a good thing.

Ok, thanks to you both for explaining.

However, I'm not able to make that to jibe... still missing something
I'm sure.

I understand why there needs to be a reserved 'anonymous' symbol for the
--rest-of-cl-- e.g. --cl-rest-- and that this symbol should remain uninterned
but what I am missing on is why --cl-keys-- is converted to `cl-keys' whereas
--cl-rest-- can't/isn't in the `cl-do-arglist' function? For example,

In the following both `body' and `--cl-rest--' show as being interned whereas
the `*-wombats' aren't:

(intern-soft "body") ;=> t
(intern-soft "--cl-rest--") ;=> t
(intern-soft "scary-flying-wombats") ;=> nil

(mapatoms (lambda (x)
            (when (string= (symbol-name x)
                           ;; "body")       ;=> (found body)
                           ;; "--cl-rest--") ;=> (found --cl-rest--)
                           "scary-flying-wombats") ;=> nil
              (prin1 `(found ,x))))
          obarray)

(intern-soft "more-wombats") ;=> nil
(make-symbol "more-wombats") ;=> more-wombats

(mapatoms (lambda (x)
            (when (string= (symbol-name x) "more-wombats")
              (prin1 `(found ,x))))
          obarray)
 ;=> nil

(member 'cl-keys (help-function-arglist 'reduce)) ;=> (cl-keys)
(member 'body (help-function-arglist 'unless)) ;=> (body)

(BTW Everything above was evaluated on two systems and with `emacs -Q'.
With the same results.)

Is not the the now-maybe arg/keyword acting acting in a manner similar
to &key's --cl-keys--, e.g. it
is let bound not setq'd:

(defun* 3rd-degree (q z w &key now-maybe)
  (let ((3d (make-symbol "now-maybe")))
    (when now-maybe
    3d)))

(help-function-arglist '3rd-degree)
;=> (q z w &rest --cl-rest--)

(member 'now-maybe (help-function-arglist '3rd-degree))
;=> nil

(intern-soft "now-maybe")
;=> now-maybe

(mapatoms (lambda (x)
            (when (string= (symbol-name x) "now-maybe")
              (prin1 `(found ,x))))
          obarray)
;=> (found now-maybe)

IOW `now-maybe' is interned directly via the let form whereas `--cl-rest--'
appears to be indirected through let via restarg in `cl-do-arglist' e.g.

(setq restarg (make-symbol "--cl-rest--")

I'm _not_ advocating a change but it would be good to understand vis a vis
Miles' admonition:

"That is a good thing."

What would be the consequences if user level keys following &rest i.e.
:mon-key0 :mon-key1
:mon-key2 _were_ to be interned directly (maybe on a partitioned
obarray) instead of
passing the buck to --cl-rest--?

Again, asked out of curiosity :)

s_P




reply via email to

[Prev in Thread] Current Thread [Next in Thread]