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,gmane.lisp.guile.bugs Subject: Re: [shift and reset, plus] "while" Date: Wed, 13 Apr 2011 17:41:37 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1302709304 24147 80.91.229.12 (13 Apr 2011 15:41:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Apr 2011 15:41:44 +0000 (UTC) Cc: bug-guile@gnu.org, guile-devel To: Wolfgang J Moeller Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Apr 13 17:41:39 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QA2CI-0002d6-Dz for guile-devel@m.gmane.org; Wed, 13 Apr 2011 17:41:38 +0200 Original-Received: from localhost ([::1]:59078 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA2CH-0007OX-UY for guile-devel@m.gmane.org; Wed, 13 Apr 2011 11:41:37 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA2CC-0007O2-DT for guile-devel@gnu.org; Wed, 13 Apr 2011 11:41:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QA2C6-0002LG-Q7 for guile-devel@gnu.org; Wed, 13 Apr 2011 11:41:32 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:49092 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA2Bu-0002HQ-2Q; Wed, 13 Apr 2011 11:41:14 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 0D54B3C5D; Wed, 13 Apr 2011 11:43:11 -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; s=sasl; bh=4tWSDIxPBzx8itedx2v7wtEF4Aw=; b=gBUchM FR7qOh2EvSlGOfWrL1gu5ilyNJKb8PsfZJUR7Cn6P0Izqv+askpicTOv1q7NZ4wO mzLzZRAjtQs8p6zCIWJ/GJ0RwP0/WE9Yu1om+76yFMaRes4EXMaQODSXWx0lFRnX dKwYeNdmWL3yvUrK87NIgaoAQpjEx+oCohNyY= 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=L3VjvUD7Fdx/fBJeosMMQsrzcJh0D5kL 186NNaR9xY8lUiVK6XfMtftoDV5bvN1+xZAto8G3h+oJJ9shD1xj4OnK2XnqEmqt XWg4/S+ayMWn+5nB4JfvJu+E4A8rJQPFZ+xSQqi1luD4BGEU495kOMWphV2TuGcF 2NdKySQbDP4= 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 DEE7C3C5B; Wed, 13 Apr 2011 11:43:07 -0400 (EDT) Original-Received: from unquote.localdomain (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 DEF5C3C55; Wed, 13 Apr 2011 11:43:04 -0400 (EDT) In-Reply-To: (Wolfgang J. Moeller's message of "Wed, 13 Apr 2011 16:56:50 +0200 (CEST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: BA940E4E-65E4-11E0-8CF1-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.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:12240 gmane.lisp.guile.bugs:5478 Archived-At: On Wed 13 Apr 2011 16:56, Wolfgang J Moeller writes: > On Wed, 13 Apr 2011, Andy Wingo wrote: > >>[...] >> > I'd like to "improve" (while) as currently provided by ice-9/boot.scm >> > >> > (a) to always have a well-defined result >> >> This is a good idea; it allows `while' to be an expression, not just a >> statement. >> >> > (b) to allow for (break arg ...) >> >> Also a good idea. >> >> Tricky, though; your comments indicate that you would want (break) to >> return #t, instead of zero values. > > Does anyone like to _test_ for zero values? Not me. > As regards the REPL, you still can (break (if #f #f)). > > Alternative: return zero values on "normal termination", > instead of #, so the REPL keeps quiet then, > as it did before. Not as handy, but at least well-defined. > > I don't remember if GUILE V1.6 had the return values of #f and #t, > or if they were my own invention ... IIRC it did have (break arg) > with a single argument. Anyway, #t is compatible with V2.0.0 . >From Guile 1.6: (defmacro while (cond . body) `(letrec ((continue (lambda () (or (not ,cond) (begin (begin ,@ body) (continue))))) (break (lambda val (apply throw 'break val)))) (catch 'break (lambda () (continue)) (lambda v (cadr v))))) It did indeed happen to return #t on a normal termination, and have (break ARG). It has lots of other bugs though. I would prefer (break) to return zero values, and (while #f 1) as well, but that is incompatible with 2.0. Bummer. > Not exactly tricky - see my code's prompt handler. I didn't mean in terms of code; I meant in terms of documentation, interface, expectations, etc... >> > (d) to correct a buglet that currently transforms the non-operator `continue' >> > into a function of arbitrarily many (as opposed to zero) >> > arguments. I hadn't seen this one because Mark Weaver fixed it a few weeks ago, in ddf134cfec0d82ea9f39ddd69948c08feecb9576. Cheers, Andy -- http://wingolog.org/