unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Linus Björnstam" <linus.bjornstam@veryfast.biz>
To: "Maxime Devos" <maximedevos@telenet.be>, guile-devel@gnu.org
Subject: Re: [Patch] definitions in when,   unless,   do as well as in cond- and case-clauses
Date: Thu, 17 Jun 2021 14:57:58 +0200	[thread overview]
Message-ID: <2548315a-b028-443a-85e9-ebfd4758f701@www.fastmail.com> (raw)
In-Reply-To: <ef00de3ec6212a2827f778972913bc6daa076d4f.camel@telenet.be>

Guile already does definitions in expression context in the bodies of lambda and let-variants. I think this is not a big problem since any valid r6rs code is still valid guile.

The discussion is in my opinion whether guile's r6rs modules should enforce this behaviour. That might be a good thing, even though we will provide 2 cons and case forms to do that.

-- 
  Linus Björnstam

On Thu, 17 Jun 2021, at 11:06, Maxime Devos wrote:
> Linus Björnstam schreef op wo 16-06-2021 om 21:11 [+0200]:
> > Hi there!
> > 
> > This patch updates some derived conditional forms (and do and and-let*)
> > to support definitions in expression context. Meaning it makes this valid code:
> > 
> > (cond 
> >   ((pred? arg) 
> >     (define a (something arg))
> >     (when (error-case a)
> >       (error "a is broken"))  [...]
> 
> This seems a useful change to me. However, this is not valid R6RS.
> From <http://www.r6rs.org/final/r6rs.pdf>:
> 
> (cond hcond clause1i hcond clause2i . . . ) syntax
> => auxiliary syntax
> else auxiliary syntax
> Syntax: Each hcond clausei must be of the form
> (htesti hexpression1i . . . )
> where htesti is an expression. Alternatively, a
> hcond clausei may be of the form
> (htesti => hexpressioni)
> 
> This seems a compatibility pitfall, so maybe note
> in the documentation that using definitions in the clauses
> is a Guile and Racket extension and not standard R6RS?
> 
> (I try to write Scheme code as R6RS / R7RS library & define-library
> forms, importing mostly R6RS / R7RS & SRFI libraries, though I occasionally
> use a Guile extension.)
> 
> Greetings,
> Maxime
> 
> Attachments:
> * signature.asc



  reply	other threads:[~2021-06-17 12:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 19:11 [Patch] definitions in when, unless, do as well as in cond- and case-clauses Linus Björnstam
2021-06-17  9:06 ` Maxime Devos
2021-06-17 12:57   ` Linus Björnstam [this message]
2021-06-17 13:54     ` Maxime Devos
2022-02-03 10:48 ` Linus Björnstam
     [not found]   ` <CAGua6m1Cqe=aLOD7-jfzoqxP1aOxvWn3=UgcKyk+Dx7_51Bq3w@mail.gmail.com>
2022-02-04 20:11     ` Fwd: " Stefan Israelsson Tampe
2022-02-04 20:58       ` Maxime Devos
     [not found]         ` <CAGua6m11r27x=rq4S4fF09vHY+S-Az7GOZfmoT41hEBDSkLJQg@mail.gmail.com>
2022-02-04 21:40           ` Fwd: " Stefan Israelsson Tampe
2022-02-04 23:39           ` Maxime Devos
2022-02-05  1:14             ` Stefan Israelsson Tampe
2022-02-05 10:55               ` Maxime Devos
2022-02-05 17:31                 ` Stefan Israelsson Tampe
2022-02-05 17:36                   ` Maxime Devos
2022-02-06  6:44                   ` Linus Björnstam
2022-02-06  9:27                     ` tomas
2022-02-06  9:40                       ` Maxime Devos
2022-02-06  9:45                       ` Linus Björnstam
2022-02-06 10:48                         ` tomas
2022-02-06 20:13                           ` Stefan Israelsson Tampe
2022-02-06 20:28                             ` Maxime Devos
2022-02-06 20:31                               ` tomas
     [not found]                               ` <CAGua6m3BHMXOhT3PHZcxdqHqHomTFESO31j5CcSNK3pbA7K-Kg@mail.gmail.com>
2022-02-06 21:26                                 ` Maxime Devos
2022-02-06 21:27                                   ` Maxime Devos
2022-02-07  5:56                             ` Linus Björnstam

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=2548315a-b028-443a-85e9-ebfd4758f701@www.fastmail.com \
    --to=linus.bjornstam@veryfast.biz \
    --cc=guile-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /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).