[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: |
Maxime Devos |
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 |
User-agent: |
Evolution 3.38.3-1 |
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.
signature.asc
Description: This is a digitally signed message part
- Re: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Linus Björnstam, 2022/02/03
- Message not available
- Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Stefan Israelsson Tampe, 2022/02/04
- Message not available
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses,
Maxime Devos <=
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Stefan Israelsson Tampe, 2022/02/04
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Maxime Devos, 2022/02/05
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Stefan Israelsson Tampe, 2022/02/05
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Maxime Devos, 2022/02/05
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Linus Björnstam, 2022/02/06
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, tomas, 2022/02/06
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Maxime Devos, 2022/02/06
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Linus Björnstam, 2022/02/06
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, tomas, 2022/02/06
- Re: Fwd: [Patch] definitions in when, unless, do as well as in cond- and case-clauses, Stefan Israelsson Tampe, 2022/02/06