From: Robert Klemme Date: 2006-01-25T21:03:12+09:00 Subject: Re: String#de_inspect (and Kernel#suspicious) Erik Veenstra wrote: >> A question: what is the advantage of this over YAML? > > 1) It's faster (see below). Probably because it uses the highly > optimized parser/lexer/whatever of the Ruby interpreter > itself. (You can turn off the suspicious mode if the data > can be trusted, which makes it faster then YAML. If the > suspicious is enabled, it's as fast as YAML.) > > 2) Memory (suspicious mode turned off) (see below). > > 3) It's small, whereas YAML is relatively huge. (Is being small > an advantage? Not necessarily, but I mention it anyway...) > > 4) You can store not only raw data, but code as well. (I know, > this is really DANGEROUS, like macros in Word. That's why I > introduced Kernel#suspicious.) > > 5) I my real situation, I raise an exception if the line, read > from the journal, doesn't end with \r, \n or both. This is > an indication for a corrupted journal. Half a line in the > journal could be valid Ruby code and, as such, appear to be > valid data. That's why I check for the "commit". (Maybe YAML > does this too. I don't know.) That's quite an impressive list. I'm glad I asked. Kind regards robert