From: Kirk Haines Date: 2017-01-06T13:32:39-07:00 Subject: [ruby-core:78998] Re: [Ruby trunk Bug#13110] Byte-based operations for String --===============1381729185== Content-Type: multipart/alternative; boundary=001a113f84c8b4753f054572ed44 --001a113f84c8b4753f054572ed44 Content-Type: text/plain; charset=UTF-8 On Fri, Jan 6, 2017 at 9:24 AM, 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 --001a113f84c8b4753f054572ed44 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On F= ri, Jan 6, 2017 at 9:24 AM, <shugo@ruby-lang.org> wrote:<= br>

I'm implementing a text editor, in which the point of a buffer is repre= sented 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 operati= ons in Ruby strings ever since the post 1.8.x changes were made, and have t= hought at various times about just biting the bullet and implementing somet= hing for similar reasons to yours.

My software mak= es use of buffers of network data where the character encodings are irrelev= ant. They are just streams of bytes being moved around, and sometimes manip= ulated along the way, and the byte based operations that you propose would = be extremely useful.


Kirk Haines
--001a113f84c8b4753f054572ed44-- --===============1381729185== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Unsubscribe: --===============1381729185==--