[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: |
Tue, 21 Sep 2021 08:31:31 +0200 |
User-agent: |
mu4e 1.6.6; emacs 28.0.50 |
Hi Jean,
>> Why can't you defvar wrs::variables? Or maybe it already is? In
>> that case, you could just replace `dlet' with `let*'.
>
> Thanks Tassilo for the tip, though I have tried to use `defvar' and
> `let*' and that does not work in my case. I cannot technically explain
> it why. Practically, lexical binding script is calling in my case
> dynamical binding function.
>
> By using `defvar' and subsequently `let*' I can avoid the first error.
>
> I cannot however get the variables to pass over to the function in
> dynamical binding script `rcd-template-eval' that is supposed to work
> with variables.
>
> This worked with `dlet' before, not it does not work.
>
> Developer changed `dlet' to fit whatever programming habits, but
> deleted the functionality of `dlet*'
>
> I really need it.
>
> rcd-template-eval: `eval' error: (void-variable languages_extension)
> for match: 'languages_extension'rcd-template-eval: `eval' error:
> (void-variable areas_id) for match: 'areas_id'rcd-template-eval:
>From that error, I assume you now have code like this:
(let* ((wrs::variables ...)
(languages_extension (gethash "languages_extension" wrs::variables))
(area_id (gethash "area_id" wrs::variables)))
(do-stuff))
where the binding of languages_extension and area_id can access the new
value of the defvar wrs::variables (because of let*) but
languages_extension and area_id are only bound lexically (because they
are not defvar-ed and should not because of their missing prefix)
meaning they are bound only in the body of this `let*' (lexically!) but
not in `do-stuff' when it is called in this `let*'s body. So for those,
you really need dlet. Assuming that area_id never depends on the value
of languages_extension etc, you probably can use
(defvar wrs::variables nil)
(let ((wrs::variables ...))
(dlet ((languages_extension (gethash "languages_extension" wrs::variables))
(area_id (gethash "area_id" wrs::variables)))
(do-stuff)))
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, 2021/09/20
- 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 <=
- 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