From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.user Subject: Re: Are symbols garbage collected? Date: Mon, 23 Oct 2017 21:03:41 +0200 Organization: Organization?!? Message-ID: <87d15delf6.fsf@fencepost.gnu.org> References: <87fua9n48o.fsf@dustycloud.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1508785510 7071 195.159.176.226 (23 Oct 2017 19:05:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 23 Oct 2017 19:05:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Oct 23 21:05:02 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6i1q-0007wo-AW for guile-user@m.gmane.org; Mon, 23 Oct 2017 21:04:50 +0200 Original-Received: from localhost ([::1]:40195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6i1x-00072V-Ih for guile-user@m.gmane.org; Mon, 23 Oct 2017 15:04:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6i1Y-00072D-E3 for guile-user@gnu.org; Mon, 23 Oct 2017 15:04:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6i1T-0003JN-P0 for guile-user@gnu.org; Mon, 23 Oct 2017 15:04:32 -0400 Original-Received: from [195.159.176.226] (port=45650 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e6i1T-0003IS-I5 for guile-user@gnu.org; Mon, 23 Oct 2017 15:04:27 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1e6i1G-0003Rg-Jq for guile-user@gnu.org; Mon, 23 Oct 2017 21:04:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw Cancel-Lock: sha1:corBFNaoftIGX0jKKK+Yy9S5oGM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14226 Archived-At: Christopher Allan Webber writes: > I thought they weren't but now I'm not really sure where I got that > idea from. Does anyone know for sure? They are garbage-collected. This is not overly relevant outside of C/C++ code since as long as any code references a symbol, it will stay around. It's only when you look at things like its address independent of the symbol that you'd notice. scheme@(guile-user)> (object-address 'blablaaaaaa) $4 = 94515697299616 scheme@(guile-user)> (gc) scheme@(guile-user)> (object-address 'blablaaaaaa) $5 = 94515696660320 scheme@(guile-user)> Similar for hashq: without the symbol being stored somewhere, it will likely deliver different values each time round. If you put this into code rather than retyping it on the command line, the address will be the same each time. You'd need to use something like (string->symbol "blablaaaaaa") in order to get different addresses: a literal symbol in the code would be protected. -- David Kastrup