On 6/2/06, Dave Howell <groups / grandfenwick.net> wrote: > > Do you use the YAML parser in Ruby? > > No. > > > Or the String class? > > Yes. > > > They're C. > > I find that assertion to be quite ludicrous. A C string is a > null-terminated byte sequence. I've happily never had to use to any > great extent any other language that didn't effectively insulate me > from any need to track the terminal null (the vast majority don't even > *use* that, but rather store the length as an integer at the front of > the string), or that allowed my code to inadvertantly overwrite the > terminal null, thus turning a string into an object of indefinite > length, sucking down whatever random bytes lay beyond the end of the > actual string bytes until it found some other "00x0" in memory. > > The String class is not only nothing like a C string, it's not a string > at all, in the sense that any/all other languages I've met use the > term. It's an Object, and that makes it act in ways fundamentally > different than the strings I've met in SQL, AppleScript, Modula-2, > Pascal, or Basic (various dialects, all with line numbers), to name a > few. They're written in C. Or, rather, in the standard implementation of Ruby, they're written in C. The statement makes perfect sense. Whether a String is represented as an Object or a primitive or a green baboon is irrelevant. > > Ruby and C are old friends. If you really want to know Ruby, you need > > to know at least some amount of C. > > You're going to have to provide some rather compelling evidence before > I give that opinion much credence. Ruby and Perl are "old friends," > too. Nevertheless, if there are aspects of Ruby that came from these > languages, and I cannot learn them directly and exclusively via Ruby, > that just says to me that the Ruby documentation still needs work. You don't need to know C to know Ruby. But to know how the standard C implementation, the one you can download from ruby-lang.org, works, then you're gonna have to know some C. Ruby is a computer language. In theory, it is indenpendent from the implementation, and that's an important distinction. There's JRuby, for example. Bt realistically, most people use the C Ruby implementation, and you can't ignore that. -- - Simen