This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-06
Channels
- # announcements (3)
- # architecture (16)
- # beginners (5)
- # cherry (1)
- # cider (3)
- # cljsrn (2)
- # clojure (54)
- # clojure-dev (11)
- # clojure-europe (14)
- # datalevin (26)
- # emacs (8)
- # helix (5)
- # honeysql (5)
- # hyperfiddle (40)
- # lsp (12)
- # malli (23)
- # missionary (7)
- # nrepl (2)
- # off-topic (18)
- # releases (2)
- # yamlscript (1)
Why does the java impl of Clojure use for(; ;)
? There are places that have returns on every branch, so i'm not sure what's gained.
You mean, why for (;;)
instead of while (true)
Or why an otherwise infinite loop if it didn't have return
and/or break
in its body?
If the first question, it seems like six of one and half a dozen of the other to me.
If the second question, then an otherwise infinite loop with explicit return
or break
statements is sometimes the most straightforward, easy-to-understand and write construct there is, especially if there is part of the loop body you always want to do at least once, and part that you might never want to do.
Out of curiosity, do you find such code unclear, perhaps?
Why have it at all? LispReader’s method read
has it and ends in an unconditional return statement. The body cannot loop.
(Sorry to ask a question then immediately fall asleep lol)
There’s a continue
on line 288 which looks like makes it loop on “no op” macros