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: The empty string and other empty strings Date: Tue, 10 Jan 2012 08:03:06 -0500 Message-ID: <87y5tf90c5.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> <87boqfa8cd.fsf@netris.org> <874nw353a4.fsf_-_@gnu.org> <1326194907.55971.YahooMailNeo@web37901.mail.mud.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1326200654 395 80.91.229.12 (10 Jan 2012 13:04:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Jan 2012 13:04:14 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-devel@gnu.org To: Mike Gran Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jan 10 14:04:07 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 1RkbN0-0002af-Hq for guile-devel@m.gmane.org; Tue, 10 Jan 2012 14:04:06 +0100 Original-Received: from localhost ([::1]:60470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkbN0-00030H-1q for guile-devel@m.gmane.org; Tue, 10 Jan 2012 08:04:06 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkbMq-0002z4-4t for guile-devel@gnu.org; Tue, 10 Jan 2012 08:04:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkbMg-0006on-95 for guile-devel@gnu.org; Tue, 10 Jan 2012 08:03:55 -0500 Original-Received: from world.peace.net ([96.39.62.75]:60184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkbMg-0006m0-6d; Tue, 10 Jan 2012 08:03:46 -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 1RkbMY-00055z-7n; Tue, 10 Jan 2012 08:03:38 -0500 In-Reply-To: <1326194907.55971.YahooMailNeo@web37901.mail.mud.yahoo.com> (Mike Gran's message of "Tue, 10 Jan 2012 03:28:27 -0800 (PST)") 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:13463 Archived-At: Mike Gran writes: > Right now it seems that=C2=A0zero-length shared substring of a wide strin= g is > wide.=C2=A0 A zero-length substring still shares the=C2=A0stringbuf of the > original string. [...] > What do you think about that?=C2=A0 Do zero-length substrings need to > still share stringbufs with their parent strings? I think the answer is: no they don't, and avoiding that might be a worthwhile optimization, mainly to avoid needlessly holding a reference to a potentially large stringbuf. > In any case, a string-copy of a narrow substring of an otherwise wide str= ing > should be a new narrow string.=C2=A0 This should apply to zero-length > substrings as well.=C2=A0 This isn't happening, because we're missing > a scm_i_try_narrow_string in string-copy, which is a bug. I just fixed this. > Looks like for=C2=A0zero-length input=C2=A0strings, u32_conv_from_encodin= g can > return NULL. Interesting! Anyway, we now avoid calling `u32_conv_from_encoding' for empty strings. Thanks, Mark