From: Rick DeNatale Date: 2008-01-03T23:53:20+09:00 Subject: Re: multibyte strings & bucket-of-bytes efficiency under 1.9.0 After reading this thread, and looking at the the title, let me make the humble suggestion that it might be fruitful to focus on the "bucket-of-bytes" issue separately from "stringness." Do buckets of bytes really need to look like strings, support regexes, etc? An alternative might be to use an array of bytes, but there are obvious inefficiencies there. What if there were a new primitive object type introduced, something like T_BYTEARRAY The idea comes from Smalltalk which has a few basic object types, Smalltalk objects normally consist of some number of object pointers (i.e. the equivalent to a VALUE) but there's also a special type of byte-indexable object which is an array of bytes, i.e. the elements can only be integers between 0..255. Bytearrays can be efficiently implemented both in terms of space and speed. Of course there would be ways to convert a String to and from a ByteArray, and perhaps a variant of Array#pack which would produce a ByteArray instead of a String... Probably a bit more work than what's been proposed so far on this thread, but perhaps worth some discussion? -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/