From: Sean O'D. <se...@ce...> - 2004-02-05 16:53:59
|
On Wednesday 04 February 2004 01:17 pm, Oren Ben-Kiki wrote: > Section 3.3.2 in the (work in progress) spec: > > "The plain scalar style exception allows unquoted values to signify > numbers, dates, or other typed data, while quoted values are treated as > generic strings. With this exception, a processor may match plain > scalars against a set of regular expressions, to provide automatic > resolution of such types without an explicit tag." > > Is this what you had in mind? Sort of yes, sort of no. We have the yaml.org types, and developers can add their own domain/private types, and Syck deals with that very well. With the patch I gave _why, now developers (the Ruby ones at least) can transparently resolve scalars to their own native data types from inside Ruby. That all works very well, from a programmer's perspective. But from just a YAML author's perspective, it would be nice to have the ability to specify that certain scalars load as certain known types (either yaml.org types or user-defined domain/private types), like the "ohyeah" = "bool#yes" mapping example I gave. Another example is if someone is producing a YAML document in German and in a value where they had intended a "bool#yes" value to appear, they put "ja" or something. Perhaps just for clarity, or because they're working with decidedly non-technical types and they get confused if they don't see the word "ja" or whatever. For whatever reason, they just want to use "ja" instead of the English "true" or "yes." If that German fellow decided to use that YAML with some other program that loaded the YAML values into native data types, it wouldn't see "ja" as "yes." If he could somehow mark-up the YAML document to show that "ja=bool#yes" then "ja" would load as the native type used to show a true value in whatever language/library the program used. Sean O'Dell |