-
Notifications
You must be signed in to change notification settings - Fork 15
Description
We are considering deprecating quoted keys. This will be a change that is not backward compatible. You can see the discussion that triggered this decision here. To summarize, the feeling is that:
- Quoted keys add considerable complexity to both the implementation and support (ex: they added considerable complexity to implementation of Vim syntax highlighting) that is not consistent with the design philosophy of NestedText.
- The approach taken is unique and unfamilar to everyone that encounters it.
- Distinguishing the key from the value can be difficult in some cases.
- The approach taken is not in keeping with the other concepts of NestedText.
- Even with quoting, there are some strings that cannot be used as keys.
- Quoted keys provide too little value given the above issues.
Eliminating quoted keys further limits the strings that can be used as keys. We are considering adding multi-line keys to replace quoted keys. It is felt that multi-line keys are more in keeping with the style of NestedText than quoted keys were, and they allow NestedText to accept any string as a key.
Multi-line keys are patterned after multi-line strings, except the string tag >␣ is replaced by the dict tag :␣ and a trailing indented value is required. For example:
: this is the first line of a multi-line key
: this is the second line
> this is the value
This would be interpreted as:
{
"this is the first line of a multi-line key\nthis is the second line": "this is the value"
}
Multi-line keys are not expected to be commonly used, but they are being considered because the fit naturally in the language and they make NestedText completely general, meaning that with multi-line keys NestedText can handle any combination of lists, dictionaries, and strings, where the leaf values are all strings. We could not say that previously.
Comments?