From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: request tmpfile(3) wrapping in Guile 1.9 libguile Date: Mon, 08 Feb 2010 12:11:17 +0100 Message-ID: References: <877hqoubkv.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1265627834 32716 80.91.229.12 (8 Feb 2010 11:17:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Feb 2010 11:17:14 +0000 (UTC) Cc: guile-user@gnu.org To: Thien-Thi Nguyen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Feb 08 12:17:07 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NeRc2-0008IC-8K for guile-user@m.gmane.org; Mon, 08 Feb 2010 12:17:06 +0100 Original-Received: from localhost ([127.0.0.1]:53213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NeRc1-0001Ci-DG for guile-user@m.gmane.org; Mon, 08 Feb 2010 06:17:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NeRVc-0007EO-3L for guile-user@gnu.org; Mon, 08 Feb 2010 06:10:28 -0500 Original-Received: from [140.186.70.92] (port=53846 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NeRVW-0007CT-H6 for guile-user@gnu.org; Mon, 08 Feb 2010 06:10:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NeRVQ-0003d9-RT for guile-user@gnu.org; Mon, 08 Feb 2010 06:10:21 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:55464 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NeRVQ-0003d4-9H for guile-user@gnu.org; Mon, 08 Feb 2010 06:10:16 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 2578A981E7; Mon, 8 Feb 2010 06:10:15 -0500 (EST) 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; s=sasl; bh=SeJ7+7QmuHbOyRiVUU+5kRQ6Sug=; b=Phto+f VYDJxvcoZ6MMJ/8dG0dE05Cdaajp3/gLvWsQahxpNygZlAY1uZMnHABMIZBnLlrb USZxzYEjqiv5si0LwbDf4GVCm0qfNnjj573pPH3ZPO/j/ArJHU2jhpD80M3seeNe 5vvDY4g1Yjz3vwjOuHnBzsTLumz+/e7YqHb8E= 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; q=dns; s=sasl; b=HdNwzZuJwYTlWd0GLbkiw1RXPUsC58kG BkI7z8v2WwSuKt0ZQ0vnbtJXudawb3Qtowzvysl+DZBV2P+WhvZbeSZSSIjjDDLS W6YWHY/gZJKAUGw8/PWEC2A7vLA/yAZlwsjzyJAUFEu0Q5pwwC/X7EIzrLFtvNcT hWosLRtFttU= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 1142A981E6; Mon, 8 Feb 2010 06:10:14 -0500 (EST) Original-Received: from unquote (unknown [83.202.38.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 8687F981E5; Mon, 8 Feb 2010 06:10:12 -0500 (EST) In-Reply-To: <877hqoubkv.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Sun, 07 Feb 2010 19:48:00 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 87D336EA-14A2-11DF-81DB-6AF7ED7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7622 Archived-At: Hi Thien-Thi, On Sun 07 Feb 2010 19:48, Thien-Thi Nguyen writes: > I'm writing to request that tmpfile(3) be added to Guile 1.9 libguile. I think this sounds like a good idea. I have a few concerns, though if none of them can be nicely addressed I'd still be happy adding tmpfile. 1. tmpfile(3) returns a FILE*, whereas Guile's fports normally deal in file descriptors. Will this be a problem? What about buffering? Do we have to fclose() the FILE* to get deletion working? 2. Why return 'tmpfile as the name, and not whatever filename one can get from the FILE* ? 3. Is tmpfile(3) really needed, if you have mkstemp! and dynamic extents? Here's what I use, for example: (define-macro (unwind-protect form . cleanups) `(dynamic-wind (lambda () #t) (lambda () ,form) (lambda () ,@cleanups))) (define (call-with-temp-file contents proc) (let* ((template (string-copy "/tmp/tekutiXXXXXX")) (tmp (mkstemp! template))) (display contents tmp) (close tmp) (unwind-protect (proc template) (delete-file template)))) Granted, one has to consider what to do on rewind... Regarding that, I enjoyed Taylor Campbell's entry from http://mumble.net/~campbell/blag.txt about unwind-protect. Anyway, I digress. Anyone have thoughts about these? Andy -- http://wingolog.org/