From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Han-Wen Nienhuys" Newsgroups: gmane.lisp.guile.devel Subject: Re: Internal visibility Date: Mon, 9 Jun 2008 22:51:39 -0300 Message-ID: References: <87k5i5d6ei.fsf@ossau.uklinux.net> <87lk2jhp0h.fsf@gnu.org> <87skwrce8y.fsf@ossau.uklinux.net> <87iqxledzz.fsf@gnu.org> <87lk2futg0.fsf@ossau.uklinux.net> <87fxslr1jr.fsf_-_@gnu.org> <878wxv5t7q.fsf@gnu.org> <87mym6dv6t.fsf@gnu.org> <49dd78620806091110v7a667787mef392fbf4446139d@mail.gmail.com> Reply-To: hanwen@xs4all.nl NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1213066762 12795 80.91.229.12 (10 Jun 2008 02:59:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Jun 2008 02:59:22 +0000 (UTC) Cc: guile-devel@gnu.org To: "Neil Jerram" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 10 05:00:03 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5u5a-00057j-FK for guile-devel@m.gmane.org; Tue, 10 Jun 2008 05:00:02 +0200 Original-Received: from localhost ([127.0.0.1]:32787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5u4n-0003dk-Mb for guile-devel@m.gmane.org; Mon, 09 Jun 2008 22:59:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5t1W-0003bs-IY for guile-devel@gnu.org; Mon, 09 Jun 2008 21:51:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5t1V-0003aW-7A for guile-devel@gnu.org; Mon, 09 Jun 2008 21:51:46 -0400 Original-Received: from [199.232.76.173] (port=35155 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5t1U-0003aT-Vp for guile-devel@gnu.org; Mon, 09 Jun 2008 21:51:45 -0400 Original-Received: from wa-out-1112.google.com ([209.85.146.178]:48089) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5t1U-0002m4-EY for guile-devel@gnu.org; Mon, 09 Jun 2008 21:51:44 -0400 Original-Received: by wa-out-1112.google.com with SMTP id m34so2020182wag.10 for ; Mon, 09 Jun 2008 18:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Akgde/BrA2OFodD/7qr2jqN+Zh2APcgwO2sdJ0ZwqcY=; b=qlbywc9hV6mqNte0XemLrAk8cRrhARl6QZnnpHfb9qQh2GxOMN53VGQXz1Hv9uc4td k+BjEAF0wzD34KfioE2/4mbTWxN8YOudB78HdvJqbsUxFKWaKSrSWIdIffcMkUvjCjwq LNJC7GurNrd1je0qnMw6JKKPfg/c/V8lki/As= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=d8PenMoyc5q2oau/iVXKd56wWjY7daOA/BC+PjF9HJO7KbZj/Afif8STW5FR9wLhEW VzYeG3h8Rx+uTnAzlZxf9XYkiBDciiOeHIn/ver/DAH79WvADv3LHpPzKfoqKllvroht ccqvSfFediLt3sP6UuEYD+PU4MfnWQQjHmxQc= Original-Received: by 10.114.178.13 with SMTP id a13mr4218552waf.182.1213062699983; Mon, 09 Jun 2008 18:51:39 -0700 (PDT) Original-Received: by 10.114.173.4 with HTTP; Mon, 9 Jun 2008 18:51:39 -0700 (PDT) In-Reply-To: <49dd78620806091110v7a667787mef392fbf4446139d@mail.gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 09 Jun 2008 22:55:44 -0400 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7311 Archived-At: On Mon, Jun 9, 2008 at 3:10 PM, Neil Jerram wrote: > 2008/6/1 Han-Wen Nienhuys : > >> const char* ptr = scm_i_string_chars(scmval); >> string x(ptr); >> >> is the most straightforward and efficient way to create a string. >> Using the API incurs an additional malloc, memcpy and free. > > Does "string x(ptr)" incur a malloc and memcpy? > > I assume it must do, or else the code above would be unsafe (sharing > memory between the C++ and SCM strings). So, assuming it does, why do > you think this is Guile's problem, and not C++'s? I think there is some confusion here. To me, a string is a sequence of bytes. When I need higher level behavior (eg. UTF-x handling), I convert the sequence of bytes appropriately. Does the insistence on not providing a const char* interface mean that there are plans to change the representation dynamically? > Guile's string API is aiming not to be 8-bit-assuming, and I would > guess from the code above that the C++ string class is 8-bit-assuming. Sorry, I guess I don't understand. What _is_the assumption for representing strings in GUILE? -- Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen