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,gmane.lisp.guile.bugs Subject: Re: Null (begin) blocks - V2.0.3 reports error was OK in V2.0.2 Date: Tue, 22 Nov 2011 00:02:35 +0100 Message-ID: <87d3cl13lg.fsf@pobox.com> References: <4ECA89A5.5090202@hulin.org.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1321916591 2691 80.91.229.12 (21 Nov 2011 23:03:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 Nov 2011 23:03:11 +0000 (UTC) Cc: bug-guile , Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-user , Han-Wen Nienhuys To: Ian Hulin Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Nov 22 00:03:06 2011 Return-path: Envelope-to: guile-user@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 1RSctB-0008Ed-Pb for guile-user@m.gmane.org; Tue, 22 Nov 2011 00:03:02 +0100 Original-Received: from localhost ([::1]:35163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSctB-00075W-A4 for guile-user@m.gmane.org; Mon, 21 Nov 2011 18:03:01 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:36033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSct3-00074R-On for guile-user@gnu.org; Mon, 21 Nov 2011 18:02:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RScsz-0005Va-IF for guile-user@gnu.org; Mon, 21 Nov 2011 18:02:53 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:62177 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RScsq-0005Uf-DH; Mon, 21 Nov 2011 18:02:40 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id C21398161; Mon, 21 Nov 2011 18:02:39 -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:content-transfer-encoding; s=sasl; bh=vKI1Sa4meYIY 75qqCUcy9bNANo8=; b=ESZqFVrZwCwJzwYUMGFUDTx4Uy84crXS6frty6ksROyX zM4nVZXv4YiSiFSH7dumdGbMbOaizLIkCRNX2oDNlu0DhU3eB6KmCWiXIt3i/H62 LC8sB6Vw5j4ncT22IE0q1mPkhgGoI6Bj1bo/KLvLyRvt/yDh4djMVtSRN9eDmKY= 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=RA93Dn XD7RMC39HeTlvlzTflQOijfJcoV60Sd5OHhuG4kHYTKfU3T4qPtJNrSc0Ts//xzg QmoyrBReE7NqFCoP726oDvnzW7y+3KQlG2zKFUx/Ft355/leRihXLUehpV3vxA1E sBICyGmeBulXHqaf2ePqE8EklbYM28MYSPva8= 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 BB6598160; Mon, 21 Nov 2011 18:02:39 -0500 (EST) 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 15A6F815E; Mon, 21 Nov 2011 18:02:38 -0500 (EST) In-Reply-To: <4ECA89A5.5090202@hulin.org.uk> (Ian Hulin's message of "Mon, 21 Nov 2011 17:25:57 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: E8DD7C9A-1494-11E1-A609-65B1DE995924-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-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8968 gmane.lisp.guile.bugs:5934 Archived-At: Hi Ian! In the future, please include bug-guile@gnu.org in bug reports. It creates a ticket so we don't forget. The system changed a bit recently, but we hope that it works OK for you. It's certainly working better for us. Anyway: On Mon 21 Nov 2011 18:25, Ian Hulin writes: > (define-public (void? x) (eq? x (begin))) This is really not right, if I understand what you are checking for. These will work: (define-public (void? x) (unspecified? x)) (define-public (void? x) (eq? x *unspecified*)) (define-public (void? x) (eqv? x *unspecified*)) (define-public (void? x) (eq? x (if #f #f)) > This works in V1.8, and apparently used to work in 2.0.2 (no errors), > but in 2.0.3 > (begin) is OK at the repl, (with readline enabled and activated), but > in any sort of procedure using it causes a diagnostic, reporting > either at the repl or in .scm files, > > xxx: source expression failed to match any pattern in form (begin). Interesting. If it changed incompatibly in 2.0.x, that is a Guile bug. Sorry about that! We'll fix it. That said, though, you have a few misunderstandings here. > 6.13.1 Evaluating a series of expressions > > =E2=80=94 syntax: begin expr1 expr2 ... First of all, this documentation is not quite correct. Since R5RS there have been *two* kinds of begins: one that splices and one that sequences. I know that sounds complicated, but let me explain. It's not widely known, and many Schemers consider it to be something of a bug that they both share the same name. Scheme has two contexts: definition context and expression context. Like, you can only put nested definitions at the top of a function, before the expressions, and a function has to end with an expression. `Begin' in definition context "splices" its subforms into its containing form. This is to allow macros to expand to multiple definitions. In definition context, `begin' is just syntactic. `Begin' in expression context evaluates its subforms in order. It is used for its semantic property of sequencing effects. It is possible for a `begin' in definition context to have no subforms. But in expression context, you need an expression, and if there are no expressions to evaluate, the result is a syntactic error. That is what you are running into. > Guile also allows the expression (begin), a begin with no > sub-expressions. Such an expression returns the `unspecified' value. So, I guess we have to fix this in 2.0.x. This behavior will probably not be available in 2.2, however, so it's best to change your code now, at the same time that we fix Guile to have the old behavior (and fix the docs). Finally, we are considering having expressions that produce unspecified values actually produce 0 values. So, for example, (if #f #f) would be the same as (values). Of course it's not something we can do in 2.0, and we would try to publicise it well, but do keep it in mind. Regards, Andy --=20 http://wingolog.org/