GNU bug report logs - #48219
27.1.90; CL-LOOP facility fails with hash tables

Previous Next

Package: emacs;

Reported by: Juan José García Ripoll <juanjose.garcia.ripoll <at> csic.es>

Date: Tue, 4 May 2021 08:56:02 UTC

Severity: normal

Found in version 27.1.90

Full log


Message #17 received at 48219 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Juan José García Ripoll
 <juanjose.garcia.ripoll <at> csic.es>, 48219 <at> debbugs.gnu.org
Subject: Re: bug#48219: 27.1.90; CL-LOOP facility fails with hash tables
Date: Sat, 02 Jul 2022 16:20:00 -0400
Lars Ingebrigtsen [2022-07-02 13:24:36] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>> Yes, that does seem wrong.
>>
>> Agreed, but I don't know what the code is supposed to do when `database`
>> is not-nil, so I can't even tell if the code is meaningful.
>
> (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))
>
> Hm...  Oh, yeah -- that's not really a meaningful loop statement, is it?

I think it's not because `database` is both a loop variables (i.e. one
that iterates over elements of something else) and one of the something
else over which we want to iterate.  So the only meaningful
interpretation I can see would be 2 nested loops, but the `loop` macro
is designed to make a single loop, not nested loops.

FWIW, I just tried it with `clisp` and it happpily expands it into
a single loop which does something weird (it sets up up a hash-table
iterator to operator over "the hash-table `database`" but at a time
where the `database` variable has not yet been initialized (i.e. it's
nil)).

> But since it's a meaningless loop, perhaps erroring out in the hash
> table case is fine, too?

I'm OK with erroring out if we can emit a meaning error message.

> Whew!  That was simple!

Occam's razor, man: it's all in the shave!


        Stefan "who doesn't shave"





This bug report was last modified 3 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.