To say that SafeStr is a totally broken API is severely overstating the flaws you describe. No string implementation for C/C++ can be perfect, as I'm sure you well realize, having written one yourself. Any possible implementation is going to involve trade-offs. It's unavoidable.
You are correct in saying that any string that is modified with references may cause the other references to be left in an undefined state. Unfortunately, this is a problem with any sort of reference counting in C unless you abstract away the pointer and replace it with a handle (a la Win32) or something similar. If you're holding references to an object (whether it's a SafeStr string or something else entirely), do not modify the object. SafeStr does not prevent against doing this, but making the changes to cause SafeStr to throw an exception are minor, and we may very well do so in the next release.
You are also correct with your second point; however, this is a limitation that is clearly documented. The solution is simple: temporarily bump the reference count, perform your operations, and decrement the reference count. You can use XXL to facilitate this process by saving the string as an asset inside of an asset block.
Both of these problems are minor, obvious issues that aren't a big deal in practice. As I said, there are going to be trade-offs, no matter what, and we believe that SafeStr offers people a good set of them. SafeStr is *a* solution, but it is not intended to be *the* solution. Its trade-offs may not be acceptable to everyone, whereas those offered by bstring or other string implementations may be instead.
For quite some time now I have been reading/. religiously. Up until now I haven't posted, but after reading the load of garbage posted here today, I'm just pissed off enough to post.
The OSS community (of which I consider myself a part) has made great strides in recent years and especially in recent months using Linux as the great demonstrative work that OSS is a viable software development model. Unfortunately, the general feeling that I get from many OSS advocates (the OSS folks that seem, in a large part, to have their mouths attached to the wrong part of their anatomy) is an extremely arrogant greater-than-thou attitude. The only thing that does is to leave a bad taste in the mouths of people that may be wondering what OSS is all about. Understandably so. I know what OSS about, and the attitude still makes me sick to my stomach.
BeOS is not open source. Be has repeatedly stated that they will not make it open source. Fine, leave it be. There is a large part of BeOS that actually is distributed completely with source. Sure, the kernel and libbe.so isn't given out in source form, but every single one of the demos and many of the applications that ship with BeOS have their source included as an optional install. How many of you repeatedly posting that 'until it is OSS it does not exist' would even bother to look at any of the source and/or understand what you were looking at if it were made OSS?
I think that, to many, OSS is something of a religion that does little more than breed close mindedness. Where is it written that in order to develop open source applications for a platform, the platform itself must be open source? Where is it written that the only software of any value is open source? Get off your high horses, open your eyes, evaluate the software that is available, whether it is open or closed source, and take the software for what it is rather than what development model was used to produce it.
I could go on ranting for hours, but the point is, that software should be evaluated for what it is, how it looks, how it performs. Not how it was made. BeOS, to me, is a breath of fresh air. It isn't for everybody. It is a relative newcomer to the operating system 'market' and as such has its growing pains to go through. Linux has gone through them too don't forget.
To say that SafeStr is a totally broken API is severely overstating the flaws you describe. No string implementation for C/C++ can be perfect, as I'm sure you well realize, having written one yourself. Any possible implementation is going to involve trade-offs. It's unavoidable.
You are correct in saying that any string that is modified with references may cause the other references to be left in an undefined state. Unfortunately, this is a problem with any sort of reference counting in C unless you abstract away the pointer and replace it with a handle (a la Win32) or something similar. If you're holding references to an object (whether it's a SafeStr string or something else entirely), do not modify the object. SafeStr does not prevent against doing this, but making the changes to cause SafeStr to throw an exception are minor, and we may very well do so in the next release.
You are also correct with your second point; however, this is a limitation that is clearly documented. The solution is simple: temporarily bump the reference count, perform your operations, and decrement the reference count. You can use XXL to facilitate this process by saving the string as an asset inside of an asset block.
Both of these problems are minor, obvious issues that aren't a big deal in practice. As I said, there are going to be trade-offs, no matter what, and we believe that SafeStr offers people a good set of them. SafeStr is *a* solution, but it is not intended to be *the* solution. Its trade-offs may not be acceptable to everyone, whereas those offered by bstring or other string implementations may be instead.
For quite some time now I have been reading /. religiously. Up until now I haven't posted, but after reading the load of garbage posted here today, I'm just pissed off enough to post.
The OSS community (of which I consider myself a part) has made great strides in recent years and especially in recent months using Linux as the great demonstrative work that OSS is a viable software development model. Unfortunately, the general feeling that I get from many OSS advocates (the OSS folks that seem, in a large part, to have their mouths attached to the wrong part of their anatomy) is an extremely arrogant greater-than-thou attitude. The only thing that does is to leave a bad taste in the mouths of people that may be wondering what OSS is all about. Understandably so. I know what OSS about, and the attitude still makes me sick to my stomach.
BeOS is not open source. Be has repeatedly stated that they will not make it open source. Fine, leave it be. There is a large part of BeOS that actually is distributed completely with source. Sure, the kernel and libbe.so isn't given out in source form, but every single one of the demos and many of the applications that ship with BeOS have their source included as an optional install. How many of you repeatedly posting that 'until it is OSS it does not exist' would even bother to look at any of the source and/or understand what you were looking at if it were made OSS?
I think that, to many, OSS is something of a religion that does little more than breed close mindedness. Where is it written that in order to develop open source applications for a platform, the platform itself must be open source? Where is it written that the only software of any value is open source? Get off your high horses, open your eyes, evaluate the software that is available, whether it is open or closed source, and take the software for what it is rather than what development model was used to produce it.
I could go on ranting for hours, but the point is, that software should be evaluated for what it is, how it looks, how it performs. Not how it was made. BeOS, to me, is a breath of fresh air. It isn't for everybody. It is a relative newcomer to the operating system 'market' and as such has its growing pains to go through. Linux has gone through them too don't forget.