I think an object implementing string behavior is much better in just about every way.
Why??? To me, there's a big advantage of having *one* single string type. If the builtin strings aren't good enough and pople start coding their own "SecretString" and "FooString" and "BarString", then we'll get the same mess as C++, where the common cry of war is "Death to all strings but basic_string<>!!!"
When adding support for arbitrary string-like objects to all C modules (in particular the I/O and the Crypto code), I fear you get enough added complexity that you end up with more security bugs than you started with.
So if strings need more features, add them to the vanilla string type, and to functions operating on them. Reasonable improvement suggestions so far are
1. A per-string flag to hide a string in %O output.
2. A global runtime flag that clears all memory at deallocation time.
/ Niels Möller ()
Previous text:
2003-01-30 02:02: Subject: Re: OpenSSL wrapper vs Pike's SSL (Was: Bz2)
That was in principle what I meant with the SecretString class. I don't know if you really meant to make it possible to flag a normal string, but if you do then I think an object implementing string behavior is much better in just about every way.
/ Martin Stjernholm, Roxen IS