On 3/17/06, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> On Thu, 16 Mar 2006 18:05:11 -0700
> L505 <[EMAIL PROTECTED]> wrote:
>
(...)
> > However, string[i] isn't so convenient as the '+' operator because you
> > have to think about all your calculations quite a bit. Really string[i] is
> > "smart pchars".
> >
> > Stringbuffer type would allow you to use the + operator and eat your cake
> > too, because every time you use the + operator the getmem() is not called.
>
> Yes, for the price of memory overhead.
>
>
> > Further benefits of StringBuffer type will have to be explored - at this
> > point it does'nt have enough benefits to be justified since you can just
> > get along with string[i].
>
> If there would be a capacitated string type, I would use it. Of course it
> should work as a string. At least reference counted, :=, +, System.Pos,
> copy, length, setlength, uniquestring.
> And even nicer: the implicit uniquestring on s[]:= and the implicit
> exception frames. But this requires compiler magic.
>
SynEdit has the usual pre-allocated array of char and Copy() in the
PaintLines method to avoid reallocation. I always intendend to create
an object to handle it, I'll play with the idea today.
I'll see what I can do about Mattias suggestions too. Maybe I'll even
learn to value operator overloading ;-)
Cheers,
Flávio
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives