From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile BUG: What's wrong with this? Date: Sat, 07 Jan 2012 11:38:55 -0500 Message-ID: <87pqev8o2o.fsf@netris.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> <4F07747A.4080202@gnu.org> <87sjjsa0kh.fsf@netris.org> <4F0786AF.3060509@gnu.org> <877h13a77c.fsf@netris.org> <4F086477.7090902@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1325954370 16579 80.91.229.12 (7 Jan 2012 16:39:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2012 16:39:30 +0000 (UTC) Cc: guile-devel@gnu.org To: Bruce Korb Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 07 17:39:26 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 1RjZIg-000704-7Y for guile-devel@m.gmane.org; Sat, 07 Jan 2012 17:39:22 +0100 Original-Received: from localhost ([::1]:60259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjZIf-0007Dq-S6 for guile-devel@m.gmane.org; Sat, 07 Jan 2012 11:39:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:51649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjZId-0007DY-9R for guile-devel@gnu.org; Sat, 07 Jan 2012 11:39:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjZIc-00069E-8c for guile-devel@gnu.org; Sat, 07 Jan 2012 11:39:19 -0500 Original-Received: from world.peace.net ([96.39.62.75]:57676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjZIb-00069A-Vi; Sat, 07 Jan 2012 11:39:18 -0500 Original-Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1RjZIW-00056B-Fe; Sat, 07 Jan 2012 11:39:12 -0500 In-Reply-To: <4F086477.7090902@gnu.org> (Bruce Korb's message of "Sat, 07 Jan 2012 07:27:51 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 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:13405 Archived-At: Bruce Korb writes: > On 01/07/12 07:00, Mark H Weaver wrote: >> The right place to fix this would probably be in >> `scm_i_string_start_writing' (strings.c). > > I think it too much effort for that function. I looked at it. > The problem is that you'd have to pass it the start and end points, > that is, change its interface. Ah yes, excellent point! Indeed, it would not be enough for `scm_i_string_start_writing' to check for an empty string. Even for non-empty immutable strings, if the range of character indices passed to a string mutator is empty, then no characters will be changed, and therefore the operation should succeed. `scm_i_string_start_writing' doesn't have enough information to detect this case. I see two choices: * Modify the interface to `scm_i_string_start_writing' to give it the `start' and `end' indices. * Add checks to all string mutation functions: if the range is empty, then avoid calling `scm_i_string_start_writing'. The advantage to the first approach is that authors of future string mutators won't have to remember to handle this case specially, and I have very little confidence that they would. I'll look into this. Mark