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 15:11:43 +0100 Organization: Organization?!? Message-ID: <87ty48x6n4.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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1325859132 30629 80.91.229.12 (6 Jan 2012 14:12:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Jan 2012 14:12:12 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 06 15:12:09 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 1RjAWe-0004Fb-En for guile-devel@m.gmane.org; Fri, 06 Jan 2012 15:12:08 +0100 Original-Received: from localhost ([::1]:58635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjAWd-0005ib-RO for guile-devel@m.gmane.org; Fri, 06 Jan 2012 09:12:07 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjAWW-0005iD-BS for guile-devel@gnu.org; Fri, 06 Jan 2012 09:12:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjAWV-0003lx-AI for guile-devel@gnu.org; Fri, 06 Jan 2012 09:12:00 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:36961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjAWV-0003ls-1f for guile-devel@gnu.org; Fri, 06 Jan 2012 09:11:59 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RjAWT-00049o-Li for guile-devel@gnu.org; Fri, 06 Jan 2012 15:11:57 +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 15:11:57 +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 15:11:57 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 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:r69P/i4AyZA2nUHuMpjnSIGzb4k= 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:13351 Archived-At: Mike Gran writes: > There is an obvious syntax to construct a string immutable > object: namely to have it appear as a literal in the source code. > There thus isn't a need for a constructor function. Huh? There are _lots_ of strings which are better computed than spelled out. > But there is no constructor for a string mutable that initializes > it with a string in Guile 2.0. (string-copy "xxxxx") > There was in Guile 1.8, where > you could do (define ). No, it wasn't. guile> (define (x) "xxxxx") guile> (x) "xxxxx" guile> (string-upcase! (x)) "XXXXX" guile> (x) "XXXXX" guile> As you can see, reevaluating the definition suddenly delivers a changed result, because we are not talking about modifying a mutable string initialized with a literal, but about modifying the literal itself. Whether or not you replace the function body with (define y "xxxxx") y instead of just "xxxxx" does not change the result and does not change what happens. y does not refer to a string initialized from the literal, it refers to the literal. And changing the literal is a really bad idea. Just because you do not understand what the code did previously does not mean that the behavior was well-defined. -- David Kastrup