From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ken Anderson Newsgroups: gmane.lisp.guile.user Subject: Re: null terminated strings Date: Mon, 19 Jan 2004 12:28:59 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <5.2.0.9.2.20040119120825.0a4d48c8@zima.bbn.com> References: <87oet4ntsm.fsf_-_@ID-28718.user.uni-berlin.de> <1074245327.6733.9.camel@localhost> <87u12wjiy7.fsf@ID-28718.user.uni-berlin.de> <1074250929.6734.63.camel@localhost> <87eku0f5em.fsf@ID-28718.user.uni-berlin.de> <200401162106.NAA06037@morrowfield.regexps.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1074535865 15324 80.91.224.253 (19 Jan 2004 18:11:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 19 Jan 2004 18:11:05 +0000 (UTC) Cc: guile-user@gnu.org, prj@po.cwru.edu Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jan 19 19:10:55 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AidrS-0007IJ-00 for ; Mon, 19 Jan 2004 19:10:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aidj5-0000oH-B3 for guile-user@m.gmane.org; Mon, 19 Jan 2004 13:02:15 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Aidhk-0000Y7-RS for guile-user@gnu.org; Mon, 19 Jan 2004 13:00:52 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Aidgd-00006K-3v for guile-user@gnu.org; Mon, 19 Jan 2004 13:00:15 -0500 Original-Received: from [128.89.72.16] (helo=zima.bbn.com) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aidgc-0008Vx-OR for guile-user@gnu.org; Mon, 19 Jan 2004 12:59:42 -0500 Original-Received: from ale.bbn.com (ale [128.89.72.125]) by zima.bbn.com (8.11.4/8.11.4) with ESMTP id i0JHxYs23290; Mon, 19 Jan 2004 12:59:34 -0500 (EST) X-Sender: kanderso@zima.bbn.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Original-To: Tom Lord In-Reply-To: <200401162106.NAA06037@morrowfield.regexps.com> Original-References: <87oet4ntsm.fsf_-_@ID-28718.user.uni-berlin.de> <1074245327.6733.9.camel@localhost> <87u12wjiy7.fsf@ID-28718.user.uni-berlin.de> <1074250929.6734.63.camel@localhost> <87eku0f5em.fsf@ID-28718.user.uni-berlin.de> X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2649 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2649 At 01:06 PM 1/16/2004 -0800, Tom Lord wrote: > > From: prj@po.cwru.edu (Paul Jarc) > > > FWIW, I think that (preferably copy-on-write) shared substrings are > > valuable enough for performance > >mutation-effects-both shared substrings are valuable as a feature of >(extended) Scheme. > >A common idiom in string-manipulating programs is to manipulate and >pass around triples (STRING START END). > >It's well worthwhile to make such triples a first-class type -- the >alternative is to have to write lots of string manipulation functions >in a style where they take three actual parameters (ideally with two >of those being optional) to represent a single conceptual parameter. > >And if you have that abstract data type, since it is compatible with >the RnRS requirements for the STRING? type, it may as well be a subset >of the STRING? type. > >copy-on-write shared substrings are a performance feature -- >mutation-effects-both shared substrings are an improvement to Scheme. Can you describe how this is an improvement to Scheme? I don't think i've ever wanted to do this. In Java, which does copy-on-write i often find myself carefully copying the substrings so they don't share structure. This is because of things like: - i don't know how long the underlying string (char array actuall) is. It can be much longer than the last line i've read. - many fields are a relatively small set of values so interning them helps. - some fields become something besides strings, such as numbers. Java only has one kind of string, which is fairly heavy weight. For example, the string "" takes 36 bytes: > (describe "") is an instance of java.lang.String // from java.lang.String value: [C@d42d08 offset: 0 count: 0 hash: 0 So, it might help to have several representations for strings. In Gule, of course, you can play even more games because you have C underneath. From the applications i've seen, interning strings has been more useful _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user