[review] new string type (take 2)

Steven Wawryk stevenw at acres.com.au
Sun Jan 16 16:35:42 PST 2011


Andrei,

I note that your specific criticisms of Steve's proposal all relate to 
the "random-access" of the bidirectional code-point range.  This is 
essentially my objection too.

As you are the key person to determine whether it is adopted, what do 
you think of the remainder of his proposal?

Apart from the indexing and slicing of code-points I see a lot of merit 
to the proposal, especially that it would mean that std.algorithm would 
not need to special-case for strings any more.  It would need only be 
concerned about whether it has a random-access range or a bidirectional 
range.  The user could choose whether to pass to std.algorithm any of:

* a random-access code-unit range
* a bidirectional code-point range
* a bidirectional grapheme range, etc according to the outcome of the 
other discussions

In the interest of moving this on, would it become acceptable to you if:

1. indexing and slicing of the code-point range were removed?
2. any additional ranges are exposed to the user according to decisions 
made about graphemes, etc?
3. other constructive criticisms were accommodated?

Steve


On 15/01/11 03:33, Andrei Alexandrescu wrote:
> On 1/14/11 5:06 AM, Steven Schveighoffer wrote:
>> I respectfully disagree. A stream built on fixed-sized units, but with
>> variable length elements, where you can determine the start of an
>> element in O(1) time given a random index absolutely provides
>> random-access. It just doesn't provide length.
>
> I equally respectfully disagree. I think random access is defined as
> accessing the ith element in O(1) time. That's not the case here.
>
> Andrei



More information about the Digitalmars-d mailing list