Email list hosting service & mailing list manager

Re: If you like "u8vector" ... Per Bothner (17 May 2005 16:43 UTC)
Re: If you like "u8vector" ... Michael Sperber (20 May 2005 13:05 UTC)
Re: If you like "u8vector" ... Per Bothner (20 May 2005 16:20 UTC)

Re: If you like "u8vector" ... Per Bothner 17 May 2005 16:43 UTC

"Moiself" == Michael Sperber <xxxxxx@informatik.uni-tuebingen.de> writes:
Moiself> For that, it'd be helpful if the camp in favor of "u8vector"
Moiself> could suggest names for what's currently READ-BYTE,
Moiself> READ-BYTES, and READ-BYTES-N in SRFI 68.

One factor is that if you have binary I/O you might want to read other
kinds of binary numbers and just byte arrays:  A picture might be an
array of 32-bit integers, for example.  The "java.nio" package
introduced in JDK 1.4 does support reading/writing uniform arrays that
are not bytes, so this is not a complete fanciful idea.

So using a name like read-u8-n generalizes to read-u32-n in a way that
read-byte-n doesn't.

Though I don't think I'd often read a vector of u32, I think reading a
single u32 a common operation.  Many binary files formats have 16-bit
or 32-bits values.  Of course there are byte-order issues - see below.

So I suggest renaming read-byte to read-u8.

I'm afraid I'm not sure I understand the distinction between input-bytes
and input-bytes-all:  the spec says input-bytes-all may block
indefinitely on streams connected to interactive readers, but doesn't
say that about input-bytes - is that an oversight?

A name suggestion, if I'm understanding this right:
input-bytes -> input-u8-some and input-bytes-all -> input-u8-all.
The reverse is also possible: input-some-u8 and input-all-u8.
If so: read-bytes -> read-u8-some/read-some-u8 and
read-bytes-all -> read-u8-all/read-all-u8.

We might also consider:
read-u32le/input-u32le: read a little-endian 32-bit unsigned int.
(or read-u32-le or read-u32l.)
read-u32be/input-u32be: read a big-endian 32-bit unsigned int.
Likewise for u16/s16/s32/... etc.

We might also consider:
read-u32: either read-u32le or read-u32be, depending on whether the
port is in little-endian or big-endian mode, which might be settable.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/