unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "Juan José García Ripoll" <juanjose.garcia.ripoll@csic.es>,
	48219@debbugs.gnu.org
Subject: bug#48219: 27.1.90; CL-LOOP facility fails with hash tables
Date: Sat, 02 Jul 2022 16:20:00 -0400	[thread overview]
Message-ID: <jwv8rpbp99t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87v8sf3ggb.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 02 Jul 2022 13:24:36 +0200")

Lars Ingebrigtsen [2022-07-02 13:24:36] wrote:
> Stefan Monnier <monnier@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"






  reply	other threads:[~2022-07-02 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04  8:46 bug#48219: 27.1.90; CL-LOOP facility fails with hash tables Juan José García Ripoll
2022-07-01 12:03 ` Lars Ingebrigtsen
2022-07-01 14:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-02 11:24     ` Lars Ingebrigtsen
2022-07-02 20:20       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-07-03 12:18         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8rpbp99t.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=48219@debbugs.gnu.org \
    --cc=juanjose.garcia.ripoll@csic.es \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).