From: Oren Ben-K. <or...@be...> - 2004-08-06 20:16:52
|
On Friday 06 August 2004 20:04, why the lucky stiff wrote: > oy, discussion went off a bit -- wonderin about these questions still: > > * in example 2.20: > > > > negative infinity: (-inf) > > not a number: (NaN) > > > > what are the parens? and '-inf' doesn't match the '-.inf' in > > http://yaml.org/tags/float.html These examples are old leftovers from a geological phase in time when we considered requiring all "implicit" values to be surrounded by (). We gave up on that one. > i understand that any transformation of the user's choosing can be > applied, but the examples in the spec clearly push the recommended > types. the spec is riddled with it. people see the above examples and > think, "oh (-inf) is the default representation of negative infinity" > and "oh, 'y' represents boolean true in YAML." You caught us - we _do_ want to push the recommended types :-) the examples need to be fixed, that's all. > the ruby ext uses the recommended type sets by default. it's a > serialization language, right? i dunno, maybe that's not YAML.pm's > prerogative, but it's the quintessential thrust with the reds. part of > it is that i want the examples to load great when people are testing out > my loader+parser /slash/ part of it is that i think 'y' and 'n' are > needless-an-confusin. Like I said before, 'y' and 'n' are the worst of the lot. They are easily confused with strings and they are specific to a single language (English). I'd love to have a replacement. '+' for 'true' works fine. '-' for 'false' doesn't. Let's see... Desperate notion: Use a Unicode character for false - #00AC (NOT) comes to mind. It explicitly means "not" in Unicode, and looks like a '-', so it is very mnemonic. But I think we can't require a character that doesn't appear on any keyboard for something as basic as a 'false' value. And in print it looks too much like a '-', so people will get confused. However, thinking of 'false' being presented as 'not' leads me to... Less desperate notion: Use '!' for 'false'. Its use as a "not" operator is well established in many programming languages, so it is "reasonably" mnemonic. It requires a slight twisting of the rules, since '!' is the indicator for tags. However, since tags can never be empty, a '!' by itself is not ambiguous: true: + false: ! Hmmm. Not as nice as using '-', but not _too_ bad. Also, keep in mind this is merely the canonical form, similar to ~ for null. Both null and booleans we also support alternate presentations which are English based - null, true/yes/on, false/no/off. I think I like this. What do people feel? Have fun, Oren Ben-Kiki |