-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning/error on seq with no body #1470
Comments
I guess if one wanted 5 nils, it would be clearer to express it like: (seq [i :range [0 5]] nil) |
@sarna I think this commit may have a relevant change:
|
Although the change introduced makes sense for I found an example here where an empty-body (loop [line :iterate (file/read infile :line)
:until (string/has-prefix? ">THREE " line)]) |
With |
FWIW, in the above case, the warning (that shows up on stderr) that appears for an empty-body I think in this case, the warning should actually not happen -- there seem to be legitimate reasons to have empty-bodied |
It'd be nice if Janet warned you (threw an error, printed a warning, ...) when you don't provide the body for
seq
, for example:Right now it will happily return
@[nil nil nil nil nil]
. I can't think of a reason why a user wanted to write it this way.The same thing happens with
loop
, not sure about other looping constructs.The text was updated successfully, but these errors were encountered: