[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Bytevectors should be called u8vectors



On Thu 19 Jul 2012 02:16, Alex Shinn <alexshinn@x> writes:

> Personally, I was baffled by the R6RS decision to
> include the "v" prefix.  Given a SRFI-4-style API it
> makes sense to use a single common prefix like "v"
> since you otherwise need to take up too many
> characters for #u8, #s16, #f32, #c64, etc.  Given
> an R6RS-style API there's only one blob type and
> this isn't needed.  The syntax change here just
> seemed gratuitous.

Another data point :)  Guile implements SRFI-4 vectors on top of R6RS
bytevectors.  So we do support the #u32(...) read syntax.  It is useful
to be able to specify a vector as a sequence of u32's without regard to
endianness.

So what happens is that bytevectors in Guile have an additional field
indicating their presentation type.  For example, if "v" was created via
#u32(...)  or `list->u32vector' or what have you, then that type is u32,
and they print as u32's.  Regardless one can use any SRFI-4 or
bytevector accessor on any uniform vector.

The ability to address SRFI-4 vectors with accessors of different data
types can inhibit optimization, in the TBAA sense.  Oh well.  I don't
find strict SRFI-4 vectors to be that useful, myself.  I pack bytes more
than I do scientific computing.

Cheers,

Andy
-- 
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports