From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses Date: Sat, 5 Feb 2022 02:14:34 +0100 Message-ID: References: <7f58438c-f2fb-49b6-b7b0-22054fde6277@www.fastmail.com> <38a7683ab39f412cd6f5b137d2f6ebd6f5410c5e.camel@telenet.be> <8db379b94c9d724c833478db7e6e8a6a4f379f69.camel@telenet.be> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000cb889a05d73b1700" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2663"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Feb 05 02:17:07 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nG9hK-0000Tc-Lm for guile-devel@m.gmane-mx.org; Sat, 05 Feb 2022 02:17:06 +0100 Original-Received: from localhost ([::1]:58188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nG9hJ-0003dY-7W for guile-devel@m.gmane-mx.org; Fri, 04 Feb 2022 20:17:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nG9f8-0003EI-Tv for guile-devel@gnu.org; Fri, 04 Feb 2022 20:14:52 -0500 Original-Received: from [2607:f8b0:4864:20::1033] (port=37561 helo=mail-pj1-x1033.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nG9f5-0007ID-DH for guile-devel@gnu.org; Fri, 04 Feb 2022 20:14:49 -0500 Original-Received: by mail-pj1-x1033.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so14632797pju.2 for ; Fri, 04 Feb 2022 17:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SChpcYczN8hsJamJBYgQgBE97Yh9OTbp2f994zG0ddA=; b=Oj9pUDr/s97l1OpJfARWLYwmaYdMIH9KIDNWI8bZX+ODdrvTZ2nlYi8ibm43/GL5MS Wr3gsk9kUG8JE+pGYlWolHrmF6SisvrhNonFi4fvs3NDPa93bAgBaVC910LGcS6oItH5 wQU6GOqNsGn4imKtSdfaFHU02J3etUmaC1fg5FWNjAOlr4VDsWZGDh3iVRQH0FyUxzcg vHePIcMpMj4tdeJ2gzk+jvzcxSKmcSfCEc5MvKvBQzGRpx55U2KWhxnjF4phpumdFKEj GWnHFXdq6e02GEESLfCeu3tBpPDcgV9COcdWKQMMepuFnoTHu87EYiIF96+47OKi8ejF IEeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SChpcYczN8hsJamJBYgQgBE97Yh9OTbp2f994zG0ddA=; b=C9qktPpINeK4yVlrxpDEtK9FOakwbwCDdAfsP1CPNF7F4vE0B+iZ2MsH25q9T0EkaT SGUTGJbWcHr29ElayOZLTjHmGGZ61IGYkOnWaPgg92SjYpKtP8lAXkLnkw7esODbIwdP RoI19lAVHHtQUcvCKY7O0e+svkAsgsNhrf0/KJwCFV3CRj1z7hUgZWZz1mLR2BMMHTIK KX1cODLcLb4EgGlQJ/J2hKjJUxUQ3SCTuBEMtVAn7qCo3XyjOG8dUYy7kEWfD5davoeZ Y+0HQ5sgZsipOG/ihJfW+kYXWcfBLjlQhy620OSjt6dLUDMuVloDQrQvIHbIBIlR4423 BKew== X-Gm-Message-State: AOAM532vT71+89IIadJKzNB/pl4tQFeMFJhY3tKGWoOlGP5uPPpDRNzF w1OP3MMay0eoOmgk1RiiTtfbPDN1Rg35rdVUxPM= X-Google-Smtp-Source: ABdhPJybATMQ2kSaESxNAaF01WRJ/i49VU+SnMhGJxdaIJUDpiGJoXAMG4Gfl2rrDIUGLFsmJ5wyK9VLDynGTPZ+K0g= X-Received: by 2002:a17:903:234e:: with SMTP id c14mr5915562plh.50.1644023685808; Fri, 04 Feb 2022 17:14:45 -0800 (PST) In-Reply-To: <8db379b94c9d724c833478db7e6e8a6a4f379f69.camel@telenet.be> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1033 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=stefan.itampe@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21070 Archived-At: --000000000000cb889a05d73b1700 Content-Type: text/plain; charset="UTF-8" For conditional variables you gave a default value. So then why on earth do you not have an implicit let ? There must be a good reason. On Sat, Feb 5, 2022 at 12:39 AM Maxime Devos wrote: > 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 variables (but then I usually only consider Guile Scheme > and the RnRS, so this doesn't mean much). In my experience, I have > never seen a need for conditionally defining a local variable in Scheme > code (if you have a real-world example, please share). > > It also seems impossible to implement this w.r.t. the macro system --- > what should, say, bound-identifier=? do when one of its identifiers is > only conditionally bound? Or for another example: > > If I do > > (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)) > (foobar foo)) ;; <--- *** > > then sometimes the 'foo' in '***' refers to the global variable 'foo' > and hence 'foobar' expands to the "it's a foo'.' Sometimes the 'foo' > in '***' refers to the local variable 'foo' (!= the global foo) hence > 'foobar' expands to the "it's not a foo ...". > > However, it's impossible for a macro to expand to multiple things at > once! > > Greetings, > Maxime. > --000000000000cb889a05d73b1700 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
For conditional variables you=C2=A0gave a default value. S= o then why on earth do you not have an implicit let ?
There must be a g= ood reason.

On Sat, Feb 5, 2022 at 12:39 AM Maxime Devos <maximedevos@telenet.be> wrote:
Stefan Israelsson = Tampe schreef op vr 04-02-2022 om 22:40 [+0100]:
> Anyhow conditional defining vars is a common theme in other languages<= br> > 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<= br> defining local variables (but then I usually only consider Guile Scheme
and the RnRS, so this doesn't mean much).=C2=A0 In my experience, I hav= e
never seen a need for conditionally defining a local variable in Scheme
code (if you have a real-world example, please share).

It also seems impossible to implement this w.r.t. the macro system ---
what should, say, bound-identifier=3D? do when one of its identifiers is only conditionally bound?=C2=A0 Or for another example:

If I do

(define foo 'bar)
(define-syntax foobar
=C2=A0 (syntax-rules (foo)
=C2=A0 =C2=A0 ((_ foo)
=C2=A0 =C2=A0 =C2=A0(begin (pk "it's a foo!") foo))
=C2=A0 =C2=A0 ((_ goo)
=C2=A0 =C2=A0 =C2=A0(begin (pk "it's not a foo ...") goo))))<= br>
(define (zebra stripes)
=C2=A0 (if stripes
=C2=A0 =C2=A0 =C2=A0 (define foo 'quux))
=C2=A0 (foobar foo)) ;; <--- ***

then sometimes the 'foo' in '***' refers to the global vari= able 'foo'
and hence 'foobar' expands to the "it's a foo'.'= =C2=A0 Sometimes the 'foo'
in '***' refers to the local variable 'foo' (!=3D the globa= l foo) hence
'foobar' expands to the "it's not a foo ...".

However, it's impossible for a macro to expand to multiple things at once!

Greetings,
Maxime.
--000000000000cb889a05d73b1700--