[r6rs-discuss] [Formal] get-bytevector-some may be difficult to implement
Per Bothner <per_at_bothner.com> writes:
> Ludovic Court?s wrote:
>> The semantics of `get-bytevector-some', as I understand it, are similar
>> to that of read(2) on a blocking file descriptor:
>
> Not really: With read(2) the caller *supplies* a buffer, and the
> requested size is also provided.
Right, but that's a separate issue. (It's true that
`get-bytevector-some!' could be useful.)
>> it returns at least 1
>> byte and up to the number of requested bytes; a return value of zero
>> indicates end-of-file.
>
> But for get-bytevector-some there is no "number of requested bytes".
>
> My complaint is primarily editorial: "available data" could mean
> "available without blocking" or it could mean "available in the
> internal buffer".
Whether read(2) actually blocks for a long time or not depends on the
underlying resource type. At any rate, when it succeeds, read(2) can
return any number of bytes between 1 and the number of requested bytes.
`get-bytevector-some' has no "number of requested bytes", so it can
return any amount of data that is "convenient". Again, what is
"convenient" will certainly depend on the underlying port type and its
implementation.
Thanks,
Ludovic.
Received on Thu Mar 15 2007 - 15:01:37 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC