On Apr 24, 2013, at 03:04 , Marvin Humphrey <[email protected]> wrote:

> If we're convinced that immutable String is a good idea, would you be OK
> starting with the current CharBuf implementation minus the mutability and
> working from there?  Or are we not yet there?

Yes, I think starting with the current CharBuf implementation is the best way 
to forward. Switching to iterators at the same time also seems like a good idea.

For substrings with a shared buffer, we could use something similar to 
ViewCharBuf, only with an additional reference to the original string for 
refcounting.

> I'm persuaded that exporting is the best approach.
> 
> No matter how we implement String, we will continue to be able to support
> NUL-terminated exports.  In contrast supporting a cached UTF-8 representation
> would paint us into a corner.
> 
> The practical consequences are:
> 
> *   String will not support Get_Ptr8().
> *   Both String and CharBuf will need to support various flavors of
>    Export_Raw_UTF*()
> *   CharBuf should stop worrying about NUL-termination except at export time.
>    (It's broken by CB_Set_Size() anyway.)
> *   If CharBuf continues to provide support for Get_Ptr8(), NUL-termination
>    will be the user's responsibility.

+1. Maybe Export_Raw_UTF should simply return a malloced raw pointer and make 
it the caller's responsibility to free it.

Nick

Reply via email to