std.bitarray examples

Sean Kelly sean at invisibleduck.org
Sat May 10 21:06:49 PDT 2008


Janice Caron wrote:
> On 10/05/2008, Sean Kelly <sean at invisibleduck.org> wrote:
>>> That is an entirely separate subject. There is a proposal on the table
>>  > suggested by Steven Schveighoffer and myself which addresses that very
>>  > problem, and our proposal sounds similar to your romaybe. However,
>>  > that is not relevant for std.string.
>>
>> It's relevant in that the implementation of std.string could benefit from
>>  the proposal, were it implemented.
> 
> Not so. The invariant versions will use copy-on-write. That is a huge,
> huge, plus for invariant strings, and no one wants to lose it. At the
> other end of the spectrum, mutable char arrays offer the possibility
> of modify-in-place, which invariant clearly cannot do. There is no way
> that Steven's/my inout proposal would be sufficient to achieve all
> that is needed for std.string.

I remember Walter saying that he was surprised at how many string 
operations did not actually involve in-place modification, and I took 
this as an explanation for why std.string is designed the way it is. 
The problem with std.string is that one cannot use it with mutable 
strings /at all/, and Steven's proposal would change this quite naturally.


Sean



More information about the Digitalmars-d mailing list