-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
API breakage with IO::Evented#evented_read
#14747
Comments
Could you explain what you're using it for? |
It's part of my input loop in Benben, which runs on a separate fiber. The code was written before Benben was changed to use S-Lang for its TUI library, and the separate fiber was required back then in order to keep the program from freezing and waiting for input. While I plan to change to using S-Lang directly for input in a future version in Benben, I don't know when this change will occur (definitely not anytime soon - I'm in a code freeze at the moment). The API was publicly available, and there are other bits of the stdlib that are public but not documented, so I didn't think it was internal. |
Yea, going back to EDIT: And #14367 |
@MistressRemilia I'm quite intrigued to learn about how you came up with the idea to use
|
@Blacksmoke16 It's unfortunate that The methods in this module are very low-level features which require an understanding of the event loop details to use them properly (there's no public documentation either). Who ever has this understanding would realize that there's no reason to call them from user code (they're only useful for stdlib implementation and not relevant for user code applications) and be aware of the implications if they still find an esoteric use case ;) |
@straight-shoota We should at least go back and add the |
This is pretty old code (back when it just interfaced raw with the terminal) and so my memory may be a bit fuzzy, but without the As I said, I do intend to switch to using S-Lang for input in the future, but not for the upcoming v0.5.0 release of Benben at the end of July. Though if I need to postpone my release so I can get this change in and have it be well-tested, I will. This is the second time I've run into stdlib API breakage, so I wanted to at least report it. |
Yeah, thanks for reporting. It's certainly good to talk about it. Now we'll need to figure out what we want to do about it. I'm pretty sure this would've never had any effect. |
This is related to the RFC 7 refactor. Both @straight-shoota maybe we should undocument @MistressRemilia I second @straight-shoota's analysis: since |
Will
|
@yxhuvud We probably won't be able to, since we want to support whatever kind of event loop. While epoll and kqueue could, I'm not sure about io_uring and that won't work with IOCP. For pipes we can use File since #14255 (released in 1.12?): File.open("path/to/fifo", blocking: false) Manual polling, however, isn't in RFC 7. You might want to comment your (valid) use-case there. If you have some ways to implement it, that would be even better. Maybe just a pair of |
I'm fairly certain pipes have worked more or less fine since a very long time. At the very least since before MT as pipes are what is used to send fibers between threads. But that is beside the point - the actual kind of file descriptor doesn't matter all that much for this usecase as long as it has a meaningful definition of being readable and being able to act on that without actually reading.
io-uring supports it no problem. It is literally what the existing (though probably outdated) uring branch is built on.
I'd be very fine with that as looking at readability/writability as far as I know is not an established way to interact with other things on windows as it is elsewhere. And the APIs that would use that don't work on windows anyhow (not counting WSL). I did look into if it was possible to implement them on windows, and IIRC, the situation is something like "yeah, readability wait can sortof be implemented in a limited way using private interfaces, and writability is just not possible. |
I removed the call and yeah, it works, so this is fine enough for now. There was a time it didn't, but it's been long enough that I can't remember why (yay bad memory!). |
I think we can close this. |
IO::Evented#evented_read
Crystal v1.12.2 and previous has this for the signature:
But the current trunk as of time of writing (commit [a1db18c]) has this signature:
The change is totally understandable (
slice
is pointless in the older version, it's just yielded again), and is technically not that big of a deal... but the removal breaks the API despite the semantic version major number not increasing, which looks bad and necessitates populating code with silly{% if compare_versions(Crystal::VERSION, "1.13.0") <= 0 %}
calls.The text was updated successfully, but these errors were encountered: