From: Oren Ben-K. <or...@be...> - 2004-09-13 05:24:17
|
On Monday 13 September 2004 08:13, Clark C. Evans wrote: > Here is the proposal... > > %REGEX perl-compatible-regex implied-tag -1. > So, if someone wanted the parser to distinguish between 12 > and '12', they could add: > %REGEX [-+]?(0|[1-9])[0-9,]* tag:yaml.org,2002:int > to their prologue, and bing, all unquoted integers will be > reported as an integer. Oy Vey :-) I think this example, by itself, is enough to kill the proposition here and now. YAMl is supposed to be human friendly, not require them to type REGEXPs into their documents! > This proposal also gives pretty printers a bunch of flexibility, > if a pretty-printer discovered that 20 percent of the tags in the > document were integers, it could add this REGEX and then not > bother with a !!int tag on those items. Of course, it would have to very that none of the other 80% didn't match the regexp. And since its a pretty-printer and can't know the type-by-path rules used in the document, it can't do that. So, next thing you'll want is: %CONTEXT .../x tag:yaml.org,2002:float And then we'll have, in each YAML document, a mandatory embedded full-typing schema. > That's it. I'm not really for or against beacuse I have not > thought-through the impliciations. It's just an idea. Putting aside the rusty-rezor-blade syntax of regexps, the sheer amount of directives it would take to type a simple config file, the fact that this replicates 80% of what a proper schema language would do, the pressure to move the whole sorry mess to an external document, and so on... This essentially repeats the motivation for XML DTDs. Experience has shown that the use of DTDs for anything but validation is horribly wrong. Let's not go there. Have fun, Oren Ben-Kiki |