[r6rs-discuss] [Formal] get-bytevector-some may be difficult to implement

From: Michael Sperber <sperber>
Date: Thu Mar 15 09:42:06 2007

Per Bothner <per_at_bothner.com> writes:

> It is unclear to me how one would implement get-bytevector-some.
> I don't think it can be implemented reasonably using the read
> call-back function of make-custom-binary-port. The best I can think
> of: allocated some largish buffer, call the read call-back, and
> the re-allocate a new bytevector with however many bytes were
> actually read. But that still won't return "a freshly allocated
> bytevector of non-zero size containing the available data" -
> just "a freshly allocated bytevector of non-zero size containing
> *part* of the available data".

That depends on your notion of "available data", but I agree it should
be clarified.

> And it means allocating a temporary large bytevector and throwing it
> away.

That depends on your implementation: You storage manager might allow
you to allocate a large object and reduce its size later. (The Scheme
48 GC actually behaves this way.)

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla
Received on Thu Mar 15 2007 - 09:28:38 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC