guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and


From: tomas
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

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]