In the mean time i fixed some things that were wrong, added a few functions and the tests. I found some weird things while doing this, probably bugs. So here's the patch i promised.
Can you please rediff string.pmc - it is in the CVS already, but you did provide the whole file. I've checked in the other changes though.
(3 tests failing - likely becausof missing pieces from string.pmc)
The function string_make() in src/string.c reads in the documentation: "the the string reperesentation will default to enum_stringrep_unknown".
A new string will get the default / global settings from the interpreter, which we don't have yet.
As i understand, the default implementation for the function is_equal_str() in a PMC is to fall back to is_equal(). This works OK.
is_equal_str() forces both sides being strings. This is the default for strings is_equal, so they are the same.
But when i actually tried to implement is_equal_str(), it turns out the return condition is used backwards (true means false :).
Its modeled like strcmp().
Now back to the String class. I should say that much of the code was inspired by PerlString, and the tests, well, i just took them from perlstring.t. There's still some original code there tough :)
Leo suggested to subclass PerlString from String, but it's already subclassed from PerlScalar, do PMC's have multiple inheritance?
Not really albeit OrderedHash does it. But for PerlString its totally ok to inherit from String only. Most of the functionality is the same.
And a noob question: what does the $Id: line at the top of each file do? Is it generated or do I have to uptade it myself?
Its generated by CVS. The variable $Id$ gets expanded to what you see there -- so no.
alexm
Thanks, leo