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

2022-02-06 Thread Linus Björnstam
Historical garage maybe. I just remember some old bug in WebKit where let was a lot slower than var because it created what was called lexical context which affected interpreter speed because of some kind of linear time variable lookup. Anyway, that stuff doesn't apply to guile versions after

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

2022-02-06 Thread Maxime Devos
Maxime Devos schreef op zo 06-02-2022 om 22:26 [+0100]: > FWIW, Guile already exports unportable syntax in (rnrs base): > R6RS doesn't mention named let anywhere, yet Guile exports it as > 'let' > in (rnrs base) anyway. Nevermind, R6RS has named let:

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

2022-02-06 Thread Maxime Devos
Stefan Israelsson Tampe schreef op zo 06-02-2022 om 22:10 [+0100]: > I think you are right on this, I looked at the scheme spec and I find > no trace for using a let or not or not in the spec. > So it is an implementation detail. Now, this is important, if I want > to write portable code if cond

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

2022-02-06 Thread tomas
On Sun, Feb 06, 2022 at 09:28:15PM +0100, Maxime Devos wrote: > Stefan Israelsson Tampe schreef op zo 06-02-2022 om 21:13 [+0100]: > > Hmm just why conditionals use begin and not let, > > I'd assume the reason is that this is how it has been done in the past > and because of performance reasons

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

2022-02-06 Thread Maxime Devos
Stefan Israelsson Tampe schreef op zo 06-02-2022 om 21:13 [+0100]: > Hmm just why conditionals use begin and not let, I'd assume the reason is that this is how it has been done in the past and because of performance reasons (which don't seem to apply anymore?), so I guess that we could now switch

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

2022-02-06 Thread Stefan Israelsson Tampe
Hmm just why conditionals use begin and not let, On Sun, Feb 6, 2022 at 11:49 AM wrote: > On Sun, Feb 06, 2022 at 10:45:54AM +0100, Linus Björnstam wrote: > > You need to use ,optimize. > > Thanks you both, Maxime and Linus, for giving me a new lantern :) > > Cheers > -- > t >

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

2022-02-06 Thread tomas
On Sun, Feb 06, 2022 at 10:45:54AM +0100, Linus Björnstam wrote: > You need to use ,optimize. Thanks you both, Maxime and Linus, for giving me a new lantern :) Cheers -- t signature.asc Description: PGP signature

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

2022-02-06 Thread Maxime Devos
to...@tuxteam.de schreef op zo 06-02-2022 om 10:27 [+0100]: > ...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

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

2022-02-06 Thread Linus Björnstam
You need to use ,optimize. -- Linus Björnstam On Sun, 6 Feb 2022, at 10:27, to...@tuxteam.de wrote: > 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

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

2022-02-06 Thread tomas
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? >

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

2022-02-05 Thread Linus Björnstam
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 >

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

2022-02-05 Thread Maxime Devos
Stefan Israelsson Tampe schreef op za 05-02-2022 om 18:31 [+0100]: > 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? Do you mean Guile in general, or the particular example I gave? Also, I

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

2022-02-05 Thread Stefan Israelsson Tampe
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

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

2022-02-05 Thread Maxime Devos
Hi, > > (define foo 'bar) ;; <--- ^^^ > > (define-syntax foobar > > (syntax-rules (foo) > > ((_ foo) > > (begin (pk "it's a foo!") foo)) > > ((_ goo) > > (begin (pk "it's not a foo ...") goo > > > > (define (zebra stripes) > > (if stripes > > (define foo 'quux))

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

2022-02-04 Thread Maxime Devos
Stefan Israelsson Tampe schreef op vr 04-02-2022 om 22:40 [+0100]: > Anyhow conditional defining vars is a common theme in other languages > so I think it was kind of natural to implement if as it was done. AFAIK no Lisp or Scheme except for Guile < 2.0 implements conditionally defining local

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

2022-02-04 Thread Stefan Israelsson Tampe
-- Forwarded message - From: Stefan Israelsson Tampe Date: Fri, Feb 4, 2022 at 10:40 PM Subject: Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses To: Maxime Devos I tested and yes you are right, in guile conditionals do not have this

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

2022-02-04 Thread Maxime Devos
Stefan Israelsson Tampe schreef op vr 04-02-2022 om 21:11 [+0100]: > using an implicit let in conditionals are bad in that you cannot > escape from the let form which means that you loos > conditional defines for example in the toplevel. e.g. [...] While old versions of Guile (Guile 1.8?) did

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

2022-02-04 Thread Stefan Israelsson Tampe
-- Forwarded message - From: Stefan Israelsson Tampe Date: Thu, Feb 3, 2022 at 5:41 PM Subject: Re: [Patch] definitions in when, unless, do as well as in cond- and case-clauses To: Linus Björnstam using an implicit let in conditionals are bad in that you cannot escape from the

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

2022-02-03 Thread Linus Björnstam
Hi guys, It looks like a 3.0.8 might be happening. I am curious to know whether this (perhaps minus the do form) is considered something that the maintainers of guile could find interesting. If subset compatibility of r6|7rs is desired, I could provide a patch for those files as well so that

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

2021-06-17 Thread Maxime Devos
Linus Björnstam schreef op do 17-06-2021 om 14:57 [+0200]: > 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. ‘Guile already does definitions in expression context

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

2021-06-17 Thread Linus Björnstam
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

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

2021-06-17 Thread Maxime Devos
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)) >

[Patch] definitions in when, unless, do as well as in cond- and case-clauses

2021-06-16 Thread Linus Björnstam
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")) (define b (something2