From: T. O. <tra...@ru...> - 2004-09-09 02:06:55
|
On Wednesday 08 September 2004 08:24 pm, you wrote: > Provide me a thought-out specification for it, and I'll > probably add it. We will not deny a thoughtful tag ;) Full Name: Relations URI: tag:yaml.org,2002:rel Shorthand: !!rel Kind: Mapping. Definition: An unordered set of key:value pairs. A simple type similar to a mapping but without the restriction on duplicate "keys", sometimes called a 'dmap'. This type is usable as a fault-catch for when an implicit mapping fails inequality validation on its key values. Currently, the closest approximation YAML can provide to this type is a notation for representing this as a null-value mapping with two-element sequence keys. Most programming languages do not have a built-in native data type for supporting relations (an exception being Prolog). Such data types are usually provided by libraries. If no such data type is available, an application may resort to loading !!rel into a sequence of two-element sequences, and disregarding all order information. This is recommended becuase some languages cannot handle a mapping with sequences for keys. The !!rel tag may be given explicitly, or the application may choose to implicitly type invalid mappings to !!rel, rather then throw an error. Example 1. # Explicitly typed relation from null-value map of two element sequences. tasks: !!rel ? [ meeting, with team ] ? [ meeting, with boss ] ? [ break, lunch ] ? [ meeting, with client ] Example 2. # Explicitly typed relation from sequence of two-element sequences. tasks: !!rel - [ meeting, with team ] - [ meeting, with boss ] - [ break, lunch ] - [ meeting, with client ] Example 3. # An implicit relations due to unresolvable mapping, # as would occur for this example in Python. numbers: 1 : one 1.0 : one point zero > You can post this as a separate 'recommendation' you have for > post-YAML processors. If its a good idea, your module will > catch fire and everyone will use it. Ha ha. But hey, at least there it is! -- T. |