bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48219: 27.1.90; CL-LOOP facility fails with hash tables


From: Lars Ingebrigtsen
Subject: bug#48219: 27.1.90; CL-LOOP facility fails with hash tables
Date: Fri, 01 Jul 2022 14:03:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Juan José García Ripoll <juanjose.garcia.ripoll@csic.es> writes:

> (cl-loop
>  for database in nil
>  for aux = (message "databse: %S" database)
>  for entry being the hash-values of database
>  do (message "FOO %S" database))
>
> This code should do nothing, because variable DATABASE runs over an empty 
> list. Yet the macroexpansion of the loop produces code that tries to run over 
> the entries of DATABASE, which is NIL.
>
> (cl--block-wrapper
>  (catch '--cl-block-nil--
>    (let* ((--cl-var-- nil)
>         (database nil)
>         (aux nil))
>      (cl-block --cl-finish--
>        (maphash (lambda (--cl-var-- entry)
>                 (or (consp --cl-var--) (cl-return-from --cl-finish-- nil))
>                 (setq database (car --cl-var--))
>                 (setq aux (message "databse: %S" database))
>                 (message "FOO %S" database)
>                 (setq --cl-var-- (cdr --cl-var--)))
>               database))
>      nil)))

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Yes, that does seem wrong.  I had a brief look at cl--parse-loop-clause,
but this is code I haven't looked at before, and I'm not sure I
understand the control flow here.  Adding Stefan to the CCs; I'm sure he
can tell what should be done immediately.  😀

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]