On Tue, Nov 21, 2000 at 05:04:32PM +0000, Nicholas Clark wrote:
> (I'm not sure if I've missed all the fun here before I subscribed, but
> I can't anything on the RFC list that mentions the following)
> 
> perl5 has a tangle of SvPV macros to allow C code to get a pointer
> to the scalar. (or the "private", with or without the length, and
> more relating to utf8 that don't even appear to be documented)
> 
> Has any thought yet been given to the API to get scalars?
> 
> Jarkko posted an idea on p5p of "Virtual Values" which would permit a
> scalar to point to another scalar's buffer, rather than its own.

That was the other half, yes.  The other half was it that a VV would
point to a 'window' or 'slice' of the other scalar's buffer, not
necessarily the whole buffer.

> Currently the perl5 API assumes that you get a read-write pointer, and that
> the thing it points to is "\0" terminated. This makes it hard to implement
> copy on write, or to allow a pointer to a sub-length of the parent
> scalar's buffer.

What he said.

> IIRC Ilya mailed p5p bemoaning the fact that perl's SVs use a continuous
> buffer. A split-buffer representation (where a hole is allowed in the
> middle of the buffer data) permits much faster replacement type operations,
> as there is less copying, and you can move the hole around to suit your
> needs.

Yet another bummer of the current SVs is that they poorly fit into
'foreign memory' situations where the buffer is managed by something
else than Perl.  "No, thank you, Perl, keep your greedy fingers off
this chunk.  No, you may not play with it."

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to