* on using cl-do-symbols
@ 2016-11-01 18:22 Mark Oteiza
2016-11-02 12:16 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2016-11-01 18:22 UTC (permalink / raw)
To: emacs-devel
For yuks I ported auth-source to cl-lib. I encountered a warning I
don't quite understand when changing
(loop for sym being the symbols of password-data
;; when the symbol name starts with auth-source-magic
when (string-match (concat "^" auth-source-magic)
(symbol-name sym))
;; remove that key
do (password-cache-remove (symbol-name sym)))
to
(cl-do-symbols (sym password-data)
(when (string-match (concat "^" auth-source-magic) (symbol-name sym))
(password-cache-remove (symbol-name sym))))
The warning is that there is an unused binding for `sym'. cl-do-symbols
does create an outer (let (sym) …) and then inside mapatoms, another
(lambda (sym) …). Does the outer let-binding in cl-do-symbols need to be there?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: on using cl-do-symbols
2016-11-01 18:22 on using cl-do-symbols Mark Oteiza
@ 2016-11-02 12:16 ` Stefan Monnier
2016-11-02 17:56 ` Mark Oteiza
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2016-11-02 12:16 UTC (permalink / raw)
To: emacs-devel
> The warning is that there is an unused binding for `sym'.
> cl-do-symbols does create an outer (let (sym) …) and then inside
> mapatoms, another (lambda (sym) …). Does the outer let-binding in
> cl-do-symbols need to be there?
I guess it is there so as to obey the CL definition which says:
When result-form is evaluated, var is bound and has the value nil.
If that's the case, then the let-binding can be moved so it only
covers the `,(nth 2 spec)` part of the code. Personally, I'd be happy
to disobey the CL specification in this regard since I find it
completely silly.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: on using cl-do-symbols
2016-11-02 12:16 ` Stefan Monnier
@ 2016-11-02 17:56 ` Mark Oteiza
2016-11-02 18:23 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2016-11-02 17:56 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The warning is that there is an unused binding for `sym'.
>> cl-do-symbols does create an outer (let (sym) …) and then inside
>> mapatoms, another (lambda (sym) …). Does the outer let-binding in
>> cl-do-symbols need to be there?
>
> I guess it is there so as to obey the CL definition which says:
>
> When result-form is evaluated, var is bound and has the value nil.
>
> If that's the case, then the let-binding can be moved so it only
> covers the `,(nth 2 spec)` part of the code. Personally, I'd be happy
> to disobey the CL specification in this regard since I find it
> completely silly.
I agree--I can't think of a reason why var should be part of
result-form. Interestingly, in the dynamic binding part of dolist, var
is indeed set to nil.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: on using cl-do-symbols
2016-11-02 17:56 ` Mark Oteiza
@ 2016-11-02 18:23 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2016-11-02 18:23 UTC (permalink / raw)
To: emacs-devel
> Interestingly, in the dynamic binding part of dolist, var is indeed
> set to nil.
Yes, that's for backward compatibility (the lexical part doesn't need
to care about that backward compatibility ;-).
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-02 18:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 18:22 on using cl-do-symbols Mark Oteiza
2016-11-02 12:16 ` Stefan Monnier
2016-11-02 17:56 ` Mark Oteiza
2016-11-02 18:23 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.