On Fri, Jan 6, 2017 at 9:24 AM, <shugo / ruby-lang.org> wrote:

>
> I'm implementing a text editor, in which the point of a buffer is
> represented by a byte-based offset for speed.
> We can get substrings of a buffer by byteslice, but we need
> force_encoding(Encoding::ASCII_8BIT) to change
> the contents of a buffer because we don't have bytesplice:
>

I would agree. I have wished for byte based operations in Ruby strings ever
since the post 1.8.x changes were made, and have thought at various times
about just biting the bullet and implementing something for similar reasons
to yours.

My software makes use of buffers of network data where the character
encodings are irrelevant. They are just streams of bytes being moved
around, and sometimes manipulated along the way, and the byte based
operations that you propose would be extremely useful.


Kirk Haines
(supressed text/html)
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>