From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: subbytevectors Date: Sat, 09 Jun 2012 19:07:15 +0200 Message-ID: <87vcj0e7ng.fsf@pobox.com> References: <878vfwg2vw.fsf@pobox.com> <87obosbjnx.fsf@gnuvola.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339261650 26574 80.91.229.3 (9 Jun 2012 17:07:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2012 17:07:30 +0000 (UTC) Cc: guile-devel To: Thien-Thi Nguyen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jun 09 19:07:28 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SdP8K-0001dp-3j for guile-devel@m.gmane.org; Sat, 09 Jun 2012 19:07:28 +0200 Original-Received: from localhost ([::1]:49996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdP8J-0000p0-SA for guile-devel@m.gmane.org; Sat, 09 Jun 2012 13:07:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdP8G-0000oU-ES for guile-devel@gnu.org; Sat, 09 Jun 2012 13:07:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdP8E-0005TJ-2X for guile-devel@gnu.org; Sat, 09 Jun 2012 13:07:24 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:46059 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdP8D-0005Sy-Qh for guile-devel@gnu.org; Sat, 09 Jun 2012 13:07:22 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 3C8799F98; Sat, 9 Jun 2012 13:07:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=9kLleZhGTGUh c+KIwrVtu7TQcvk=; b=g3dd4hQRGF2DWHlGYh8hmoNBHgKjSm09JTH4zQJ/h6Ma 2i4J/yDz5QPUoTp6FBrUkY/sA5KB9R4jMINY3Be2jowTfnfcX2VxB/BKi8xZrDSM C4Li8nFYyjQqVdrYDOYBw6U/8xEI8uUkfsMqeE3L9uZiFGq5DNMyryE5aXYGAz4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=TrhTze hjIWNDsaQUkJQ5TzOrvolebrC35F1SMKbcxp4+HLFE5J01dgHrJRSonuPdajRXjd uA2G8Sl9527GV8m6FAsGR6Tmxegk7gobTcdy/FHQofNMyZhdPBTcKZBbr1gLbb0a VUjS7n0xhwsljK1U6qyVXz8Qr23npowrPHaN4= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 353E39F97; Sat, 9 Jun 2012 13:07:19 -0400 (EDT) Original-Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 6846C9F96; Sat, 9 Jun 2012 13:07:18 -0400 (EDT) In-Reply-To: <87obosbjnx.fsf@gnuvola.org> (Thien-Thi Nguyen's message of "Sat, 09 Jun 2012 17:16:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Pobox-Relay-ID: 91CAB756-B255-11E1-A925-8DF2579FE65A-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 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:14572 Archived-At: Hello, On Sat 09 Jun 2012 17:16, Thien-Thi Nguyen writes: > If you want to make a case for such a facility, why not > show some code, both without (status quo) and with (proposed)? > It should be clear what expressiveness is gained, and how. For example, let's say I mmap a big file. (define x (mmap-file "/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.13.so")) I did some computation and have figured out that there is a region of interest between bytes 121241 and 121263 that interests me. I would like to be able to pass off that region to some other piece of code, without giving it access to the entire bytevector. I would also like to be able to pass around=20=20 > Guile 1.4.x has =E2=80=98make-shared-substring=E2=80=99 Guile 1.8, released in 2005, has substring/shared. So does Guile 2.0. IIRC -- and this was a looooooooong time ago -- Marius wanted to remove it, for ease of implementation, but users were using it, so he had to put it back in. Strings and bytevectors are fundamentally different, though. > IIRC, SRFI 13 suggests that its support for substrings would > not be necessary if programmers wrote code using "range" style. > Could the client code you have in mind be rephrased like that? These are complementary strategies. Using ranges is usually more efficient, but more at times it is too cumbersome. Sometimes also you really want to restrict authority to only a certain window of the bytevector. For example, I am currently working on a problem that involves lots of work on a shared bytevector. I have to be careful to avoid printing out the bytevector because it takes a few seconds and trashes my terminal history. If I had subbytevectors, this wouldn't be as acute a problem. Andy --=20 http://wingolog.org/