[plt-scheme] bytes vs u8vector

From: Lauri Alanko (la at iki.fi)
Date: Sat Jan 28 11:29:17 EST 2006

On Sat, Jan 28, 2006 at 11:04:25AM -0500, Eli Barzilay wrote:
> A few issues:
> 
> 1. The same implementation is used for all srfi-4 vectors.  You're
>    talking about an exception for one case.

Right, it would certainly require some work, I don't doubt that. Then
again, u8vectors are arguably conceptually more primitive anyway, and
they even have a dedicated SRFI (66). In SRFI-land the basic type for
binary data is u8vector, whereas in mzscheme it is byte-string, and this
a troublesome incompatibility.

> 2. Making that one case use byte strings is not possible, since a byte
>    string always has a terminating \nul character.

I must be missing something. Yes, byte strings are allocated one longer
than their nominal length and there's a zero at the end, but I've always
thought that this is just for compatibility with standard C functions
(even though it's only useful when there are no zeros elsewhere in the
byte string). One isn't really supposed to touch the terminator anyway,
so I don't see how its presence matters.


Lauri


Posted on the users mailing list.