unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses
Date: Sat, 05 Feb 2022 00:39:03 +0100	[thread overview]
Message-ID: <8db379b94c9d724c833478db7e6e8a6a4f379f69.camel@telenet.be> (raw)
In-Reply-To: <CAGua6m11r27x=rq4S4fF09vHY+S-Az7GOZfmoT41hEBDSkLJQg@mail.gmail.com>

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

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2022-02-04 23:39 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 [this message]
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=8db379b94c9d724c833478db7e6e8a6a4f379f69.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-devel@gnu.org \
    --cc=stefan.itampe@gmail.com \
    /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).