just stumbled over this description of the Buf type in perl 6. may be of
interest to someone
http://perlcabal.org/syn/S02.html#Built-In_Data_Types
A Buf is a stringish view of an array of integers, and has no Unicode or
character
properties without explicit conversion to some kind of Str. (A buf is the
native
counterpart.) Typically it's an array of bytes serving as a buffer. Bitwise
operations on a Buf treat the entire buffer as a single large integer.
Bitwise
operations on a Str generally fail unless the Str in question can provide
an abstract
Buf interface somehow. Coercion to Buf should generally invalidate the Str
interface.
As a generic type Buf may be instantiated as (or bound to) any of buf8,
buf16, or
buf32 (or to any type that provides the appropriate Buf interface), but
when used to
create a buffer Buf defaults to buf8.
Unlike Str types, Buf types prefer to deal with integer string positions,
and map
these directly to the underlying compact array as indices. That is, these
are not
necessarily byte positions--an integer position just counts over the number
of
underlying positions, where one position means one cell of the underlying
integer
type. Builtin string operations on Buf types return integers and expect
integers when
dealing with positions. As a limiting case, buf8 is just an old-school byte
string,
and the positions are byte positions. Note, though, that if you remap a
section of
buf32 memory to be buf8, you'll have to multiply all your positions by 4.
greetings, martin.