[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master b72f885: Make dlet work like let, not let*
From: |
Tassilo Horn |
Subject: |
Re: master b72f885: Make dlet work like let, not let* |
Date: |
Mon, 20 Sep 2021 21:16:17 +0200 |
User-agent: |
mu4e 1.6.6; emacs 28.0.50 |
Jean Louis <bugs@gnu.support> writes:
> I am user and I do not expect it to work as `let' because `dlet' is
> supposed to make temporarily global variables. Now it doesn't work:
>
> (dlet ((wrs::variables (make-hash-table :test 'equal))
> (wrs::_ (puthash "areas_name" "Hyperscope" wrs::variables)))
> )
>
> error: let: Symbol’s value as variable is void: wrs::variables
>
> That is IMHO wrong, as it is supposed to bind variables
> dynamically:
Being able to refer to variables earlier in the same binding form has
nothing do with dynamic binding. `let' and `dlet' don't support that,
`let*' does, and as Mattias said, there could be a `dlet*' if someone
needs it.
What dlet allows you is to bind variables dynamically which are no
special variable (are not declared with defvar). For example:
--8<---------------cut here---------------start------------->8---
(defun foo ()
some-var)
(foo) ;; Lisp error: (void-variable some-var)
(dlet ((some-var 17))
(foo)) ;=> 17
--8<---------------cut here---------------end--------------->8---
But instead of dlet you could just as well defvar some-var and use a
normal `let' instead.
Why can't you defvar wrs::variables? Or maybe it already is? In that
case, you could just replace `dlet' with `let*'.
Bye,
Tassilo
- Re: master b72f885: Make dlet work like let, not let*, Jean Louis, 2021/09/20
- Re: master b72f885: Make dlet work like let, not let*,
Tassilo Horn <=
- Re: master b72f885: Make dlet work like let, not let*, Jean Louis, 2021/09/21
- Re: master b72f885: Make dlet work like let, not let*, Tassilo Horn, 2021/09/21
- Re: master b72f885: Make dlet work like let, not let*, Jean Louis, 2021/09/21
- Re: master b72f885: Make dlet work like let, not let*, Tassilo Horn, 2021/09/21
- Re: master b72f885: Make dlet work like let, not let*, Jean Louis, 2021/09/21