amazon-ion / ion-docs

Source for the GitHub Pages for Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
22 stars 22 forks source link

Specify that `for` clauses must define at least one local variable. #323

Closed toddjonker closed 4 months ago

toddjonker commented 4 months ago

This avoids surprises, and sidesteps making sense of (for null.list ...).

Description of changes:

For comparison, Racket's for runs the body once when no variables are introduced. That has the benefit that the result is always determined by the body (as opposed to some default defined by for), and that the whole thing isn't effectively no-op, but could also be surprising to users.

Since I personally see no need to support a no-variable option, and since we also need to handle degenerate invocations that don't have actual lists in that position, I prefer to require at least one variable and input stream.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.