From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: obarray Date: Sat, 14 Dec 2013 23:17:37 -0500 Organization: A noiseless patient Spider Message-ID: References: <87haabq6gl.fsf@nl106-137-194.student.uu.se> <87bo0irj13.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1387081217 19728 80.91.229.3 (15 Dec 2013 04:20:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Dec 2013 04:20:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 15 05:20:24 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vs3Bn-0005Hy-Pg for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Dec 2013 05:20:23 +0100 Original-Received: from localhost ([::1]:49580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vs3Bn-0004yT-CS for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Dec 2013 23:20:23 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!barmar.motzarella.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 50 Injection-Info: barmar.motzarella.org; posting-host="2be9e9f5dd9af768b8861af71b85fc28"; logging-data="13973"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hEhcSjXq+9YIPDljwsotx" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:KBzMF8N8M58LTNWb5dD1CzxwP7Y= Original-Xref: usenet.stanford.edu gnu.emacs.help:202732 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95001 Archived-At: In article <87bo0irj13.fsf@nl106-137-194.student.uu.se>, Emanuel Berg wrote: > Juanma Barranquero writes: > > > I think it's pretty clear: is a symbol table for > > (most) symbols. It is implemented as a vector, of > > prime length because of the way the hashing is done, > > and it does not make sense to examine it from Lisp > > *as a vector*, because its elements are not symbols, > > but have a more complex structure (basically, they > > implemented some kind of hash table). So the way to > > process all elements of that symbol table is to use > > mapatoms; looping over the vector won't give the > > symbols stored in the table. > > Well, that description was a lot better. > > So it is a hash table of symbols: variables, constants, > :keywords, functions, ...? > > And when you do `defvar', is the symbol name inserted > into this data structure based on some property - > perhaps the name itself, or type (if a "symbol" isn't > atomic)? Symbols are inserted into the obarray when they're interned. Either by calling the intern function explicitly, or implicitly when the symbol is seen by the Lisp reader. This is how Lisp ensures that every time you type a symbol, it refers to the same one: the first time you type it, it gets added to the obarray, and function times find the symbol in the obarray and don't create a new symbol. > Is the value inserted as well or do they use some sort > of pointer scheme? Values are unrelated to whether a symbol is in the obarray. An uninterned symbol can have a value. (setq uninterned-symbol (make-symbol "foo")) (setf (symbol-value uninterned-symbol) 'bar) This symbol "foo" won't be in the obarray, but it still has a value. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***