Log in

The myth of the "simple String API", that isn't really needed - James Antill

Oct. 4th, 2007

01:00 am - The myth of the "simple String API", that isn't really needed

Previous Entry Share Next Entry

I saw three things recently which just confirmed that noone learns anything:

Best quote by far, IMO (from the GIT thread):

"Please, no. Let's not pull in a dependency for something as simple as a string library." -- Kristian Høgsberg

As a minor good note, ustr is in Fedora and so pretty much everyone in Fedora land has access to a usable string API with a single -l ... and the newer versions of libsemanage (SELinux) use ustr. I'm not going to hold my breath for mass sanity to occur though.


Date:March 15th, 2008 05:21 am (UTC)


So it's suboptimal string implementations that's holding back world domination. I saw you quote me in your .sig at some point and had no idea what you were trying to say, this provides some context...

(Reply) (Thread)
[User Picture]
Date:March 18th, 2008 01:14 am (UTC)

Re: ah


I doubt it has anything to do with OSS world domination, closed source code is often much worse than OSS, mainly due to being even negative about deps.

It does annoy me when people assume the solution is going to be very easy (and you were far from the only one in the GIT thread -- you just had one of the best quotes :). Even now months later, the git strbuf* API is undocumented, untested and just plainbroken for edge cases. And then it doesn't have a whole bunch of features that would make it faster and easier to write/maintain.

I'd assume most of the git devs. would just argue that if you wanted to splice() parts of a strbuf into itself, or have data on the stack, or etc. etc. ... it's "just as easy" to write a custom bit of code, rather than fix the strbuf* API, but of course this is where all the bugs creep in.

A good example here would be razor, which goes to pretty extreme lengths so that it don't need a real string API in most of the code. So far in fact, that it has a kind of beauty to it atm. (the biggest distraction being the arbitrary stack limits).

But I question how long it can be kept up, esp. if it gets any kind of external API, and even with all that effort within about 10 seconds of grepping the few places it is forced to use string handling stuff I found buffer overflows.

(Reply) (Parent) (Thread)