Re: for now I'll implement using raw access and explicit user-invked COW

From: Kinkie <gkinkie_at_gmail.com>
Date: Thu, 25 Dec 2008 22:23:27 +0100

On Fri, Dec 19, 2008 at 5:57 PM, Alex Rousskov
<rousskov_at_measurement-factory.com> wrote:
> Kinkie,
>
> I still think that this plan is much better:
>
> (09:27:34 AM) rousskov: Here is an even simpler plan: write String
> without ever using non-const raw(). Get it reviewed. Optimize as step 2,
> if needed.
>
> In other words, do not use any dangerous, exceptional Buffer interfaces.
> Pass the non-performance review. Optimize later. Writing correct code
> using safe/common Buffer interfaces should not be harder than "raw
> access and explicit user-invked COW". It should be easier!
>
> You can use const raw() where needed in String, but it should not be
> needed often.
>
> You should not need any user-invoked COW, ever (if "user-invoked" means
> "explicitly initiated by user").

In the end I've ended adding a public cow() call: it's an user-invoked
optimization which doesn't hurt the semantics, and since I'm not
designing a general-purpose library I don't want to protect users
against themselves.

For the lowerCase() call I ended up not needing it, as I chose to use
public interfaces (operator[] and setAt()). Not efficient, but
efficiency can be added at a later stage if needed.

This said, I consider the framework to be reasonably complete; further
developments will be added as driven by the needs of the callers.

While waiting for review of this code by anyone willing to do it, I'll
concentrate on designing a replacement HTTP parser as an example user.
I'll try to come up with a blueprint to agree with everyone on the
general principles before trying to code a prototype.

Merry Christmas!

-- 
    /kinkie
Received on Thu Dec 25 2008 - 21:23:29 MST

This archive was generated by hypermail 2.2.0 : Fri Dec 26 2008 - 12:00:02 MST