unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer")
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Fix and-let*.
Date: Fri, 02 Oct 2015 18:37:02 -0400	[thread overview]
Message-ID: <87lhbkq4mp.fsf@netris.org> (raw)
In-Reply-To: <87zj01ufya.fsf@T420.taylan> ("Taylan Ulrich \=\?utf-8\?Q\?\=5C\=22Bay\=C4\=B1rl\=C4\=B1\=2FKammer\=5C\=22\=22's\?\= message of "Fri, 02 Oct 2015 23:18:53 +0200")

Mark H Weaver <mhw@netris.org> writes:

> taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:
>
>> Our and-let* wasn't entirely conformant to SRFI-2.  It would return #t
>> for a variety of forms where it should return the last evaluated
>> expression's value instead.
>
> Can you give some examples that demonstrate the problem?

Nevermind, I see the problem.  We don't properly handle the case with
clauses but no body.  The bug was introduced in commit
0bf4a5fc2ea456ed74d45f52e2f1dd08d5e1fb9e.

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:

> From e08e9a7e1048c8e0ad58e09585e4b6a071906db3 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
>  <taylanbayirli@gmail.com>
> Date: Fri, 2 Oct 2015 22:56:04 +0200
> Subject: [PATCH] Fix and-let*.
>
> ---
>  module/ice-9/and-let-star.scm | 50 ++++++++++++++++++++++++++++++++-----------
>  1 file changed, 38 insertions(+), 12 deletions(-)

This needs a commit log in accordance with our conventions.

> diff --git a/module/ice-9/and-let-star.scm b/module/ice-9/and-let-star.scm
> index ff15a7a..0c12f16 100644
> --- a/module/ice-9/and-let-star.scm
> +++ b/module/ice-9/and-let-star.scm
> @@ -1,6 +1,7 @@
>  ;;;; and-let-star.scm --- and-let* syntactic form (SRFI-2) for Guile
>  ;;;;
>  ;;;; Copyright (C) 1999, 2001, 2004, 2006, 2013 Free Software Foundation, Inc.
> +;;;; Copyright (C) 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
>  ;;;; 
>  ;;;; This library is free software; you can redistribute it and/or
>  ;;;; modify it under the terms of the GNU Lesser General Public
> @@ -22,20 +23,45 @@
>  (define-syntax %and-let*
>    (lambda (form)
>      (syntax-case form ()
> -      ((_ orig-form ())
> -       #'#t)
> -      ((_ orig-form () body bodies ...)
> -       #'(begin body bodies ...))
> -      ((_ orig-form ((var exp) c ...) body ...)
> +
> +      ;; Handle zero-clauses special-case.
> +      ((_ orig-form () . body)
> +       #'(begin #t . body))
> +
> +      ;; Reduce clauses down to one regardless of body.
> +      ((_ orig-form ((var expr) rest . rest*) . body)
> +       (identifier? #'var)
> +       #'(let ((var expr))
> +           (and var (%and-let* (rest . rest*) . body))))

For improved error reporting, the '%and-let*' auxiliary macro accepts
the entire original form 'orig-form' as its first operand.  Here, and in
several other places, you forgot to pass 'orig-form' down to the
recursive use of '%and-let*'.  As a result, I guess this rewritten macro
is broken for all cases with more than one clause.

Anyway, are you willing to assign copyright to the FSF for your
contributions to Guile?  If so, we can get that process started.

     Thanks,
       Mark



  parent reply	other threads:[~2015-10-02 22:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 21:18 [PATCH] Fix and-let* Taylan Ulrich Bayırlı/Kammer
2015-10-02 22:03 ` Mark H Weaver
2015-10-02 22:37 ` Mark H Weaver [this message]
2015-10-03  9:48   ` Taylan Ulrich Bayırlı/Kammer
2015-10-17 12:37     ` Taylan Ulrich Bayırlı/Kammer
2015-12-03  9:01       ` Taylan Ulrich Bayırlı/Kammer
2016-06-20 22:38         ` Taylan Ulrich Bayırlı/Kammer
2016-06-21  7:49           ` Andy Wingo
2016-06-21  8:38             ` Taylan Ulrich Bayırlı/Kammer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhbkq4mp.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=taylanbayirli@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).