Summary
allow reading without "hanging"
Metadata
- Id: 2edd703064de8deb2ad9a8627f08d91319ba9261
- Trac id: 300
- Type: enhancement
- Reporter: felix
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: not urgent at all
- Milestone:
- Version: 4.5.x
- Changetime: 2012-04-27 23:41:56 UTC
- Created: 2010-08-01 00:10:40 UTC
- Keywords: read-string no-hang
Description
(suggested by Alejandro)
It would be nice to have a "read as much of input as is currently available" type of `read-string[[!]|]`, say,
(read-string/no-hang NUM [[PORT]|]) -> STRING (may be shorter than NUM) (read-string!/no-hang NUM STRING [[PORT|[START]]]) -> NUM'
This could probably be implemented using another port method, defaulting to `char-ready?` + `read-char`.
Changes and comments
[2011-02-03 14:09:59 UTC] felix wrote:
I have added a (currently undocumented) procedure that may be helpful:
`(read-buffered [[PORT]|]) -> STRING`
This returns any currently buffered input from the given port, or "" if nothing is buffered or the port does not support buffering.
[2011-02-03 21:18:43 UTC] zbigniew wrote:
Older versions of chicken will raise an error when providing the read-buffered argument to make-input-port, and we cannot know when it is safe to do so. Would you mind adding some sort of feature identifier or other way to determine when read-buffered is a legal optional argument? This would help when create advanced custom ports.
[2012-04-27 23:35:21 UTC] felix changed priority from minor to not urgent at all
[2012-04-27 23:35:21 UTC] felix wrote:
We can not add a feature-identifier for each and every enhancement made in the core libraries (there already are too many defined anyway). I suggest checking the chicken version or something like that, which is ugly but scales somewhat better.
I'd like to close this ticket and ignore the problem until someone complains.
[2012-04-27 23:41:56 UTC] zbigniew changed status from new to closed
[2012-04-27 23:41:56 UTC] zbigniew set resolution to fixed
[2012-04-27 23:41:56 UTC] zbigniew wrote:
OK.