Brian Ingerson (ingy / ttul.org) wrote: > > > > One of the bottlenecks in YAML.rb has been using regular expressions > > to detect implicits. > > Interesting. I wouldn't have guessed this. At least in Perl, regexp > operations are usually close to pure C. Not often the source of > bottlenecks unless the regexps are poorly written. > See the problem is having to use the ten or twenty regexps that handle int, float, timestamps, nulls, nools, etc. The tokenizer in C can whittle that down to what can be thought of as a single expression. > > What are symbols? > A symbol is an entry in the symbol table represented by a name. In Ruby, symbols are designated by a colon followed by word characters. For sumbols, the following is true: :Fred.id == :Fred.id Whereas for strings: "Fred".id != "Fred".id (ID is the entry number in the symbol table.) Symbols are very efficient and often serialized. (In comparison to classes like Range and Regexp, which are serialized less often.) > > I see no reason for not putting lots of types in the repository. That's > what it is there for. The common wisdom is that type checking is done at > the loader level though. If your loader is designed for multiple > inheritance, then you can simply add a new type class as new types are > added, without have to change the parser or core loader. > Cool. > I am not suggesting that requiring a loader class effect the whole > system. That's ludicrous. Each YAML Load operation is done from a > particular YAML::Loader object. That Loader object may inherit certain > properties (like implicits) from various Loading classes, but it has one > predictable beahviour. > > In fact if a load operation involved another load operation (like with > !include processing) then a separate loader object would be used. And > that separate object might be from a completely different class. Ok. I see your angle. YAML.rb is similar. _why