3

What does the name “obarray” stand for?

Obarray seems to be a property unique to Elisp that is not found in other Lisp-like languages.
So its name probably came up with by the early Emacs developers; where did it come from?

shynur
  • 4,065
  • 1
  • 3
  • 23

1 Answers1

2

Obarray seems to be a property unique to Elisp that is not found in other Lisp-like languages

This isn't correct. Emacs Lisp is similar to / inspired by MacLisp which also includes an obarray data type, the naming of which is traced back to the oblist type used in earlier lisps.

https://lists.gnu.org/archive/html/help-gnu-emacs/2014-05/msg00214.html explains:

Yes, Object Array.

It already existed in MACLISP:
 http://www.maclisp.info/pitmanual/symbol.html

Originally, in LISP 1.5, it was an OBLIST.
cf. page 12 of http://www.dreamsongs.com/Files/HOPL2-Uncut.pdf

And in LISP 1.5 we have those occurences of OBLIST:

grep -niH -e oblist lisp15.asm
lisp15.asm:1531:       AXC     OBLIST,2           POINTER TO OBJECT LIST
lisp15.asm:1534:       RNT     DEBUGI             SKIP MARKING OBLIST IF IN A
DEBUG
lisp15.asm:8871:OBLIST SYN     BUCKET
lisp15.asm:8951:               OBLBA,,-*-1        OBLIST OBJECT
        GENER068
lisp15.asm:9921:               -OBLIST
        GPLI0823
lisp15.asm:9923:               -*-1               OBLIST
        GPLI0825

And quoting that second reference:

In 1971, Jon L White (sic) changed the representation of the data
structure that maps names (strings) to symbols from a list to a
hash table [White, 1969–1982]; thus the traditional OBLIST (list
of objects, that is, named atoms) of Lisp 1.5 was renamed the
OBARRAY.  This signaled a move to a more careful choice of data
structures to optimize size or speed.  Later implementations of
Lisp relied even more heavily on hash tables for parts of their
implementations.  The introduction of the OBARRAY marked an
important step in the increase of sophistication of Lisp
implementors.

You can also find these data types referred to in the Common Lisp documentation on Packages:

A package is a data structure that establishes a mapping from
print names (strings) to symbols. The package thus replaces the
``oblist'' or ``obarray'' machinery of earlier Lisp systems.
phils
  • 48,657
  • 3
  • 76
  • 115
  • So the “object” of “object array” means *symbol*? – shynur Mar 04 '23 at 13:31
  • 1
    I can't speak to the original intentions of the name, but in practice obarrays contain only symbols; so yes, I think that's accurate. (In Emacs Lisp at least they are implemented as vectors which are a sub-type of the array type, and vectors can contain arbitrary objects, but obarrays are explicitly used only for symbols.) – phils Mar 04 '23 at 13:51
  • N.b. For clarity, obarrays in elisp *are* also hash tables (as one of the quoted references indicates would be the case), but they aren't implemented using the general-purpose elisp hash table data type; rather they are a distinct hash table implementation for the specific purpose of interning symbols, and happen to be based on vectors. Have a look at `src/lread.c` in the source code if you want to see the details. – phils Mar 04 '23 at 15:28
  • Good answer....... – Drew Mar 04 '23 at 16:15