help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: etymology of obarray


From: Emanuel Berg
Subject: Re: etymology of obarray
Date: Fri, 16 May 2014 20:46:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

"B. T. Raven" <btraven@nihilo.net> writes:

>> Where does the word obarray originate?  What is
>> "ob"?
>
> I think it's 'object', i.e. anything that (type-of)
> returns. E.g.  (type-of 'type-of) returns > symbol,
> (type-of 1) returns > integer, etc.  There is or was
> also an oblist, which includes the same kind of info
> in a list rather than a vector.

The documentation - (describe-variable 'obarray) -
reads:

    Symbol table for use by `intern' and `read'.
    It is a vector whose length ought to be prime for best results.
    The vector's contents don't make sense if examined from Lisp programs;
    to find all the symbols in an obarray, use `mapatoms'.

Crystal clear! :)

Here is an example of how to use the obarray - to echo
simple variable values without fuss -

(defun describe-variable-short (var)
  (interactive
   (let*((v            (variable-at-point))
         (var-at-point (not (eq v 0)))
         (v-name       (if var-at-point (symbol-name v)))
         (v-final
          (completing-read
           (format " variable%s: " (if var-at-point
                                       (format " (default %s)" v)
                                       ""))
           obarray
           (lambda (vv)
             (or (get vv 'variable-documentation)
                 (boundp vv) ))
           t    ; require match
           nil  ; no insert to minibuffer (?)
           nil  ; no history
           v-name
          )))
   `(,(intern v-final)) ))
  (message (format " %s: %s" (symbol-name var) (symbol-value var))) )

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

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