unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: guile-devel@gnu.org
Subject: Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses
Date: Sun, 6 Feb 2022 10:27:51 +0100	[thread overview]
Message-ID: <Yf+Ul8isqI6ytKcz@tuxteam.de> (raw)
In-Reply-To: <daa3f801-e027-4dc0-8b7c-8a73b6427f96@www.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 1383 bytes --]

On Sun, Feb 06, 2022 at 07:44:31AM +0100, Linus Björnstam wrote:
> 
> On Sat, 5 Feb 2022, at 18:31, Stefan Israelsson Tampe wrote:
> > Hmm this was wrong, I mean
> >
> > For conditional variables we have a default begin. So then why on earth 
> > do you not have an implicit let?, Just laziness?
> > There should  be a good reason or? this is a pretty fundamental change 
> > that I support but then we should not be lazy not trying to understand 
> > the design choices of the old beards.
> 
> In other languages let starts a new lexical context which can be expensive. I don't know guile internals but a let without any defines is trivially converted to a begin by the optimizer.

It seems that in Guile 3 the expander is smart enough for an empty
bindings list in let:

| tomas@trotzki:~$ guile
| GNU Guile 3.0.7.6-22120
| Copyright (C) 1995-2021 Free Software Foundation, Inc.

[...]

| scheme@(guile-user)> ,expand (let () (message #t "Yikes"))
| $1 = (message #t "Yikes")
| scheme@(guile-user)> ,expand (let ((x 3)) (message #t "Yikes ~S" x))
| $2 = (let ((x 3)) (message #t "Yikes ~S" x))

...but doesn't "see" whether bindings are actually used (quite possibly
those go away in a later optimisation phase, though):

| scheme@(guile-user)> ,expand (let ((x 3)) (message #t "Yikes"))
| $3 = (let ((x 3)) (message #t "Yikes"))

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2022-02-06  9:27 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
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 [this message]
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=Yf+Ul8isqI6ytKcz@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-devel@gnu.org \
    /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).