From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Bindings for =?utf-8?B?4oCYc2VuZGZpbGXigJk=?= Date: Tue, 09 Apr 2013 17:02:03 +0200 Message-ID: <8761zvagt0.fsf@gnu.org> References: <87ip4liufs.fsf@gnu.org> <878v5hbblk.fsf@tines.lan> <87obed2iqo.fsf@gnu.org> <87sj32rubt.fsf@inria.fr> <87r4ik5ciy.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1365519744 26323 80.91.229.3 (9 Apr 2013 15:02:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Apr 2013 15:02:24 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 09 17:02:28 2013 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 1UPa40-00047v-8p for guile-devel@m.gmane.org; Tue, 09 Apr 2013 17:02:24 +0200 Original-Received: from localhost ([::1]:36479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPa3z-00063g-Un for guile-devel@m.gmane.org; Tue, 09 Apr 2013 11:02:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPa3s-00062U-LR for guile-devel@gnu.org; Tue, 09 Apr 2013 11:02:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPa3m-00049n-DC for guile-devel@gnu.org; Tue, 09 Apr 2013 11:02:16 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPa3m-00049R-68 for guile-devel@gnu.org; Tue, 09 Apr 2013 11:02:10 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UPa3k-0003iT-HE for guile-devel@gnu.org; Tue, 09 Apr 2013 17:02:08 +0200 Original-Received: from pluto.sophia.inria.fr ([138.96.204.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Apr 2013 17:02:08 +0200 Original-Received: from ludo by pluto.sophia.inria.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Apr 2013 17:02:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pluto.sophia.inria.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 20 Germinal an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:NlYcXvtUlvQ0l1wX3iWoHleMjzk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:16204 Archived-At: Hi! Thien-Thi Nguyen skribis: > () ludo@gnu.org (Ludovic Courtès) > () Sun, 07 Apr 2013 21:53:26 +0200 > > +In other cases, the libc function may send fewer bytes than > +@var{count}---for instance because @var{out} is a slow or limited > +device, such as a pipe. When that happens, Guile's @code{sendfile} > +automatically retries until exactly @var{count} bytes were sent or an > +error occurs. > > A short write is an opportunity for the caller to Do Something Else > (i.e., go asynchronous). I think that is more useful than internalizing > the looping. To accomodate both usage patterns, you could leave the > low-level proc as-is (as-was :-D) and provide another proc that loops. Well, I hesitated a lot. My initial inclination was to do what you say, and let users handle the looping. After a long discussion on IRC was Mark, I was mostly convinced that leaving that to users is questionable. First, because one obviously expects the procedure to send the file, not just part of it. Second, those who did not forget to implement the loop can easily get it wrong. Third, if you really want to interleave I/O and computation, you probably don’t want to use sendfile(2) in the first place. Fourth, ‘write’, ‘put-bytevector’, etc. also hide short writes. My 4¢, Ludo’.