From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile: What's wrong with this? Date: Thu, 05 Jan 2012 09:22:15 -0800 Message-ID: <4F05DC47.1000202@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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1325784148 6738 80.91.229.12 (5 Jan 2012 17:22:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 Jan 2012 17:22:28 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jan 05 18:22:24 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 1Rir1D-0006Dq-Ph for guile-devel@m.gmane.org; Thu, 05 Jan 2012 18:22:23 +0100 Original-Received: from localhost ([::1]:47935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rir1D-0007NI-8T for guile-devel@m.gmane.org; Thu, 05 Jan 2012 12:22:23 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rir19-0007N1-Rm for guile-devel@gnu.org; Thu, 05 Jan 2012 12:22:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rir18-0000uZ-E6 for guile-devel@gnu.org; Thu, 05 Jan 2012 12:22:19 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:52838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rir18-0000uV-8w for guile-devel@gnu.org; Thu, 05 Jan 2012 12:22:18 -0500 Original-Received: from adsl-75-0-186-252.dsl.pltn13.sbcglobal.net ([75.0.186.252]:56387 helo=[10.0.0.2]) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Rir17-0002TI-Ua; Thu, 05 Jan 2012 12:22:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0 In-Reply-To: <8762grf28k.fsf@netris.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 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:13324 Archived-At: On 01/04/12 15:59, Mark H Weaver wrote: > Implementing copy-on-write transparently without the user explicitly > making a copy (that is postponed) is _impossible_. The problem is that > although we could make a new copy of the string, we have no way to know > which pointers to the old object should be changed to point to the new > one. We cannot read the user's mind. So because it might be the case that one reference might want to see changes made via another reference then the whole concept is trashed? "all or nothing"? Anyway, such a concept should be kept very simple: functions that modify their argument make copies of any input argument that is read only. Any other SCM's lying about that refer to the unmodified object continue referring to that same unmodified object. No mind reading required. (define a "hello") (define b a) (string-upcase! a) b yields "hello", not "HELLO". Simple, comprehensible and, of course, not the problem I was having. :) "it goes without saying (but I'll say it anyway)": (define a (string-copy "hello")) (define b a) (string-upcase! a) b *does* yield "HELLO" and not "hello". Why the inconsistency? Because it is better to do what is almost certainly expected rather than throw errors. It is an ease of use over language purity thing.