Buffer PMC RFC

Vasily Chekalkin bacek at bacek.com
Thu Jun 3 23:57:00 UTC 2010


Hello.

After recent digging into GC guts, work on immutable strings, masak++
work on strings building I would like to propose next changes in
parrot core.

1. Remove "buffers" (which is string-like mutables). They adds a lot
of complexity to GC (finding them, compacting, etc). And they are
sharing same storage as strings which isn't good in immutable strings
world.

2. Introduce Buffer/BufferIterator PMCs. Buffer will have methods like:
  a) .push_byte, .push_word for pushing sized integers into it. (May
be .push_u8, .push_u16 will be better)
  b) .get_byte, etc to get sized integer at position
  c) .set_byte
  b) .encode(encoding) to "convert" buffer into String with predefined
encoding. Actually it will just create such string and validate it.

BufferIterator will be used as "cursor" in "packfile" functions.

If no-one objects I'm going to implement it over weekend.

-- 
Bacek


More information about the parrot-dev mailing list