emacs-devel
[Top][All Lists]
Advanced

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

Re: `setplist' on local var escaping let binding


From: MON KEY
Subject: Re: `setplist' on local var escaping let binding
Date: Wed, 20 Oct 2010 23:02:07 -0400

On Wed, Oct 20, 2010 at 9:10 PM, Stefan Monnier
<address@hidden> wrote:
>> I noticed today that if I `setplist' on a null let bound local var
>
> The above shows a misunderstanding: setplist does not operate on
> variables but on symbols.

What is this then: 'a-quoted-variable-but-not-a-symbol ?
Are you saying that `setplist' is only for top-level symbols?
Doesn't quoting the variable intern?

(let (ms)
  (setplist 'ms '(can-has a-plist))
  `(,(get 'ms 'can-has)
    ,(intern-soft "ms" obarray)))
;=> (a-plist ms)

(get 'ms 'can-has)
;=> a-plist

Appears to.

Whichever. I still don't understand how/why following happens
(nor how your answer addresses it):

(progn
  (unintern "ms" obarray)
  (let (ms)
    (setplist 'ms '(can-has a-plist))
    `(,(get 'ms 'can-has)
      ,(intern-soft "ms" obarray))))
(a-plist nil)

;=> (a-plist nil)

(get 'ms 'can-has)
;=> nil

So what am i missing?

In following `ms' is a "thing-like" bound to an uninterned "non-thing"
`bubba'. `ms' is on obarray `bubba' isn't and his symbol-value void.

(let ((ms (make-symbol "bubba")))
  (list :thing-like (intern-soft "ms" obarray)
        :non-thing (intern-soft "bubba" obarray)))
;=> (:thing-like ms :non-thing nil)

make sure its all clear:
(progn
  (intern-soft "bubba" obarray)
  (unintern "bubba" obarray)
  (intern-soft "ms" obarray)
  (unintern "ms" obarray))

In following the "non-thing" `bubba' has a plist and the thing-like is interned:

(let ((ms (make-symbol "bubba")))
  (apply #'setplist
         (list (eval (list 'quote (identity ms)))
               '(not a symbol really?)))
  `(:non-thing-bubba ,(not (intern-soft "bubba" obarray))
    :but-with-a-plist ,(apply #'get
                              (list (eval (list 'quote (identity ms)))
                                    'symbol))
    :is-thing-like-ms ,(eq (intern-soft "ms" obarray)
                           (intern-soft "ms" obarray))))
;=> (:non-thing-bubba t
;    :but-with-a-plist really\?
;    :is-thing-like-ms t)

>        Stefan

--
/s_P\



reply via email to

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