unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: `setplist' on local var escaping let binding
Date: Wed, 20 Oct 2010 23:02:07 -0400	[thread overview]
Message-ID: <AANLkTinkfo5ZUWZkhh3KT7ibTDA-TeWUAxWmxOSz34dP@mail.gmail.com> (raw)
In-Reply-To: <jwvhbggcpwa.fsf-monnier+emacs@gnu.org>

On Wed, Oct 20, 2010 at 9:10 PM, Stefan Monnier
<monnier@iro.umontreal.ca> 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	other threads:[~2010-10-21  3:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 23:28 `setplist' on local var escaping let binding MON KEY
2010-10-21  1:10 ` Stefan Monnier
2010-10-21  3:02   ` MON KEY [this message]
2010-10-21  4:26     ` Stephen J. Turnbull
2010-10-21  9:06     ` Andreas Schwab
2010-10-21 12:46     ` Davis Herring
2010-10-21 13:35     ` Thien-Thi Nguyen
2010-10-21 18:38     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinkfo5ZUWZkhh3KT7ibTDA-TeWUAxWmxOSz34dP@mail.gmail.com \
    --to=monkey@sandpframing.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).