From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile: What's wrong with this? Date: Fri, 06 Jan 2012 20:19:00 +0100 Organization: Organization?!? Message-ID: <87y5tkvduj.fsf@fencepost.gnu.org> References: <4F027F35.5020001@gmail.com> <1325603029.22166.YahooMailNeo@web37906.mail.mud.yahoo.com> <4F032C41.3070300@gmail.com> <87mxa4ifux.fsf@gnu.org> <4F038BF4.1070200@gnu.org> <87obujzmmc.fsf@Kagami.home> <4F048972.5040803@gnu.org> <87lipnm8yx.fsf@Kagami.home> <4F04D01D.5050801@gnu.org> <8762grf28k.fsf@netris.org> <4F05DC47.1000202@gnu.org> <878vlldb4k.fsf@netris.org> <1325811764.22562.YahooMailNeo@web37903.mail.mud.yahoo.com> <87wr95bo9y.fsf@netris.org> <1325857075.77324.YahooMailNeo@web37903.mail.mud.yahoo.com> <877h14bsx0.fsf@netris.org> <4F074647.1020000@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1325877566 7663 80.91.229.12 (6 Jan 2012 19:19:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Jan 2012 19:19:26 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 06 20:19:22 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RjFJw-0001No-Th for guile-devel@m.gmane.org; Fri, 06 Jan 2012 20:19:21 +0100 Original-Received: from localhost ([::1]:35104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjFJw-0002LN-Cy for guile-devel@m.gmane.org; Fri, 06 Jan 2012 14:19:20 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjFJs-0002Kt-RX for guile-devel@gnu.org; Fri, 06 Jan 2012 14:19:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjFJr-0008Vk-SV for guile-devel@gnu.org; Fri, 06 Jan 2012 14:19:16 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:57244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjFJr-0008VJ-Gp for guile-devel@gnu.org; Fri, 06 Jan 2012 14:19:15 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RjFJp-0001JB-2x for guile-devel@gnu.org; Fri, 06 Jan 2012 20:19:13 +0100 Original-Received: from p508ec932.dip.t-dialin.net ([80.142.201.50]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Jan 2012 20:19:13 +0100 Original-Received: from dak by p508ec932.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Jan 2012 20:19:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 45 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p508ec932.dip.t-dialin.net 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 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:n4gYHqzsxrs07CTNVcphSIJ9jGo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13367 Archived-At: Bruce Korb writes: > On 01/06/12 10:13, Mark H Weaver wrote: >> Imagine that you were evaluating Scheme by hand on paper. You have your >> program written on one page, and you have another scratch page used for >> the data structures that your program creates during evaluation. >> Suppose your program contains a very large lookup table, written as a >> literal list. This lookup table is on your program page. >> >> Now, suppose.... > > That is where my mental model diverges!! The mental model of the computer is what counts. >> sprintf(buf, "(define %s \"%s\")", "foo", my_str); >> scm_eval_string(buf); >> sprintf(buf, "(string-upcase! %s)", "foo") >> // the string from my_str in "buf" is now scribbled over and completely gone >> scm_eval_string(buf); > > Since I know the program I initially wrote (the define) is now gone, Why would a define be gone? > the string must have been copied off somewhere. I don't think you understand the concept of garbage collection. _Everything_ in Scheme exists permanently regarding all observable semantics (well, weak hash tables are a somewhat weird exception). Definitions, variables, continuations. There is no concept like a stack of local values that would get erased. Thanks to call/cc, there is not even a return stack that would get erased. Every object carries its own lifetime with it. It dies when nobody remembers it, not because of being in some scope or whatever else. > I think one's first guess is that it was copied to someplace > modifiable. However, that would be incorrect. It is copied off to > writable memory, but marked as read-only for the purposes of Guile. > Not intuitively obvious. Also wrong. -- David Kastrup