-
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
Mismatch between timeout behavior and docstrings of some net/* functions? #1523
Comments
So the reason these are errors instead of returning nil is pretty simple - we use the So it's pretty easy to "fix", but it's also easy to update the documentation here, and I'm not sure which is less disruptive. I would think updating the documentation would be less disruptive and break less (no) code, and while returning nil makes certain things easier to write, an error for a timeout I think is more consistent with the kind of dynamic language that Janet is. |
Yup, looking at |
net/* API documentation was not consistent with the implementation. The `ev/*` module documentation was, however. On timeout, all networking function calls raise an error and do not return nil. That was the old behavior.
Thanks for taking a look. I looked at a0eeb63 and it seems like five of the six docstrings are updated but not that for May be it makes sense to make a similar change to |
Thank you! |
The docstring for
net/read
currently has this bit:In my testing, I don't observe this behavior. AFAICT, what happens seems to be that instead of returning
nil
after the specified timeout, an error occurs.Here is some sample code that exhibited the behavior here (Linux box):
I get the following output with 6535d72:
It looks to me like the docstring ended up with timeout bits in this commit (2020-07-20).
I compiled janet from that commit and tried the code above. The resulting behavior was that
net/read
seemed to returnnil
:This matches the docstring, so perhaps something has changed between then and now.
FWIW, in the same commit, the following
net/*
functions got similar changes to their docstrings regarding timeouts. Those functions were:I also found that the CHANGELOG for 1.12.1 - 2020-09-07 had the following:
This commit seems to be where the CHANGELOG had that bit added to it.
Any hints as to what the intended behaviors are for the six functions when a timeout is specified and the timeout is exceeded?
The text was updated successfully, but these errors were encountered: