[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What's wrong with value?
From: |
Pascal Bourguignon |
Subject: |
What's wrong with value? |
Date: |
06 Feb 2003 17:50:52 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
What's happening with this symbol:
(setq value :toto) ;; C-x C-e, :toto appears in Mini-buffer.
(show value) ;; But value has not been assigned!
==> nil
(progn (setq value :toto)
(show value)) ;; well, here yes it's assigned !
==> :toto
(show value) ;; but not here !?!? What's happening?
==> nil
(show (assoc 'value (buffer-local-variables)))
==> nil
(show (version))
==> "GNU Emacs 21.2.1 (i686-pc-linux-gnu, X toolkit)
of 2002-10-26 on thalassa"
(defun show (&rest x)
"Insert the formated value X."
(unless (= (point) (progn (beginning-of-line) (point)))
(end-of-line)
(insert "\n"))
(insert (format "==> %S\n"
(if (= 1 (length x)) (car x) x)))
(if (= 1 (length x)) (car x) x)
);;show
(progn
(setq key 'ListenAddress)
(setq value '("127.0.0.3" . 25002))
(show value)
(show (symbol-value 'value))
(show (symbol-function 'value))
(show (symbol-plist 'value))
(show (assoc 'value (buffer-local-variables)))
(show (format "%-30s %s port %s\n" key (car value) (cdr value)))
)
==> ("127.0.0.3" . 25002)
==> ("127.0.0.3" . 25002)
==> (lambda (&rest local-args) "Retrieves the slot `value' from an object of
class `AEToken'" (eieio-generic-call (quote value) local-args))
==> (eieio-generic t eieio-method-tree [nil nil ((AEToken lambda (this)
"Retrieves the slot `value' from an object of class `AEToken'" (eieio-oref this
(quote value)))) nil nil nil nil] eieio-method-obarray [[0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 AEToken 0 0] [0 0 0 0 0 0 0 0 0 0 0] nil nil nil]
setf-method (lambda (widget) (block value (let* ((--widget--temp-- (gensym
"--widget--")) (--store--temp-- (gensym "--store--"))) (list (list .
#1=(--widget--temp--)) (list widget) (list --store--temp--) (let* ((widget
--widget--temp--) (store --store--temp--)) (list (quote eieio-oset) widget
(quote (quote value)) store)) (list (quote value) . #1#))))))
==> nil
==> "ListenAddress 127.0.0.3 port 25002
"
(show (symbol-value 'value))
==> nil
(show (symbol-function 'value))
==> (lambda (&rest local-args) "Retrieves the slot `value' from an object of
class `AEToken'" (eieio-generic-call (quote value) local-args))
(show (symbol-plist 'value))
==> (eieio-generic t eieio-method-tree [nil nil ((AEToken lambda (this)
"Retrieves the slot `value' from an object of class `AEToken'" (eieio-oref this
(quote value)))) nil nil nil nil] eieio-method-obarray [[0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 AEToken 0 0] [0 0 0 0 0 0 0 0 0 0 0] nil nil nil]
setf-method (lambda (widget) (block value (let* ((--widget--temp-- (gensym
"--widget--")) (--store--temp-- (gensym "--store--"))) (list (list .
#1=(--widget--temp--)) (list widget) (list --store--temp--) (let* ((widget
--widget--temp--) (store --store--temp--)) (list (quote eieio-oset) widget
(quote (quote value)) store)) (list (quote value) . #1#))))))
(show (assoc 'value (buffer-local-variables)))
==> nil
(show (format "%-30s %s port %s\n" key (car value) (cdr value)))
==> "ListenAddress nil port nil
"
Note that while 'value is a method defined with eieio, it's not the
only one and other don't have this problem:
(setq generate-conf :titi)
(show generate-conf)
==> :titi
(show (symbol-plist 'generate-conf))
==> (eieio-generic t eieio-method-tree [nil nil ((Generic . #[(self)
"\303\304\305!\"\303\306\305!\"\307
\310\"\210\212\311 !\210\312
\210\313\314!!c\210\315\316!\210\317p!\210\320\316!+\207" [self conf-file
etc-dir format "%s/etc" instance-dir "%s/etc/avmailgate.conf" make-directory t
find-file erase-buffer generate-configuration config save-buffer 0 kill-buffer
sleep] 5 "
DO: Writes the avmailgate.conf file for this test case.
"])) nil nil nil nil] eieio-method-obarray [[0 0 0 0 0 0 0 0 0 0 0] [0
Avgated-listen 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 Avgated-listen 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 Generic 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 Avgated-listen 0 0
0 0 0 0 0 0 0] nil nil nil])
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
- What's wrong with value?,
Pascal Bourguignon <=