clojure-dev

2023-08-06T01:41:13.162469Z

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.

2023-08-06T10:41:57.362889Z

Why have it at all? LispReader’s method read has it and ends in an unconditional return statement. The body cannot loop.

2023-08-06T10:42:38.618869Z

(Sorry to ask a question then immediately fall asleep lol)

Darin Douglass 2023-08-06T14:48:32.911919Z

There’s a continue on line 288 which looks like makes it loop on “no op” macros

2023-08-06T15:33:25.027109Z

Ope, i missed that. Thank you

✅ 1
2023-08-06T02:09:29.468749Z

You mean, why for (;;) instead of while (true)

2023-08-06T02:09:30.543409Z

?

2023-08-06T02:09:48.851739Z

Or why an otherwise infinite loop if it didn't have return and/or break in its body?

2023-08-06T02:10:23.020499Z

If the first question, it seems like six of one and half a dozen of the other to me.

2023-08-06T02:11:15.125369Z

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.

2023-08-06T02:12:50.576919Z

Out of curiosity, do you find such code unclear, perhaps?