On Mon, Dec 7, 2020 at 11:18 AM Oliver Smith
<
oliver...@superevilmegacorp.com> wrote:
>
> Recognizing this is likely to be a dead horse already flogged to infinity, I've been unsuccessful trying to find discussions on the topic of why while was nixed in-favor of the more verbose and error-prone for-based implementations, hoped someone could furnish links?
Using a single looping construct, for, dates back to the earliest days
of Go (well before I joined the project). There are no discussions or
links available. Back then it was just whiteboards and talking.
Go's "for" statement does, of course, support exactly the same
functionality as the "while" statement in C and similar languages (as
well as serving the functionality of the "for" statement). The
construct missing in Go is not "while" but "do/while".
> // concise, non-repetitive, positively-expressed continuation-clause:
> while n := parser.Next(); isAlpha(n) {
> // .. use of n ..
> }
Well, this doesn't work in C or related languages either. You may
want to take a look at
https://golang.org/issue/21855.
Ian