all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* intern vs. make-symbol
@ 2013-02-10 19:42 Thorsten Jolitz
  2013-02-11  1:33 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Jolitz @ 2013-02-10 19:42 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

assume org-babel-load-languages is similar to:

,-------------------------------
| ((emacs-lisp . t) (python . t))
`-------------------------------

Shouldn't this 

,------------------------------------------------------
| (assq (intern "emacs-lisp") org-babel-load-languages)
| (emacs-lisp . t)
`------------------------------------------------------

and this

,--------------------------------------------------
| (assq (eval `(quote ,(make-symbol "emacs-lisp")))
|       org-babel-load-languages)
| nil
`--------------------------------------------------

give the same results - and why isn't this so?

-- 
cheers,
Thorsten





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: intern vs. make-symbol
       [not found] <mailman.19532.1360525339.855.help-gnu-emacs@gnu.org>
@ 2013-02-10 20:46 ` tom.capey
  0 siblings, 0 replies; 4+ messages in thread
From: tom.capey @ 2013-02-10 20:46 UTC (permalink / raw)
  To: gnu.emacs.help; +Cc: help-gnu-emacs

On Sunday, February 10, 2013 7:42:01 PM UTC, Thorsten Jolitz wrote:
> Hi List,

> assume org-babel-load-languages is similar to:

> ,-------------------------------
>
> | ((emacs-lisp . t) (python . t))
>
> `-------------------------------

> Shouldn't this

> ,------------------------------------------------------
>
> | (assq (intern "emacs-lisp") org-babel-load-languages)
>
> | (emacs-lisp . t)
>
> `------------------------------------------------------

> and this

> ,--------------------------------------------------
>
> | (assq (eval `(quote ,(make-symbol "emacs-lisp")))
>
> |       org-babel-load-languages)
>
> | nil
>
> `--------------------------------------------------

> give the same results - and why isn't this so?


  They do different things.  Try these:

(eql (make-symbol "emacs-lisp")
     (make-symbol "emacs-lisp"))

=> nil

(eql (intern "emacs-lisp")
     (intern "emacs-lisp"))

=> t

`make-symbol' "[r]eturn[s] a newly allocated uninterned symbol whose name is NAME.
Its value and function definition are void, and its property list is nil."

`intern' "[r]eturn[s] the canonical symbol whose name is STRING.
If there is none, one is created by this function and returned.
A second optional argument specifies the obarray to use;
it defaults to the value of `obarray'."

/Tom
-- 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: intern vs. make-symbol
  2013-02-10 19:42 intern vs. make-symbol Thorsten Jolitz
@ 2013-02-11  1:33 ` Stefan Monnier
  2013-02-11  1:42   ` Thorsten Jolitz
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2013-02-11  1:33 UTC (permalink / raw)
  To: help-gnu-emacs

> give the same results - and why isn't this so?

Because the implicit "interning" is done while `read'ing the code
(i.e. while turning the text into a sexp), not while `eval'ing the code
(which takes a sexp and runs it).


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: intern vs. make-symbol
  2013-02-11  1:33 ` Stefan Monnier
@ 2013-02-11  1:42   ` Thorsten Jolitz
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-02-11  1:42 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> give the same results - and why isn't this so?
>
> Because the implicit "interning" is done while `read'ing the code
> (i.e. while turning the text into a sexp), not while `eval'ing the code
> (which takes a sexp and runs it).

Thanks Tom and Stefan, I think its this implicit "interning" that I
somehow expected to happen when quoting the result of 'make-symbol. 

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-11  1:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-10 19:42 intern vs. make-symbol Thorsten Jolitz
2013-02-11  1:33 ` Stefan Monnier
2013-02-11  1:42   ` Thorsten Jolitz
     [not found] <mailman.19532.1360525339.855.help-gnu-emacs@gnu.org>
2013-02-10 20:46 ` tom.capey

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.