Re: Next YAML: drop equality definition
Zenaan Harkness <[email protected]> Mon, 7 Mar 2016 09:44:15 +0000
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CAOsGNSSrmJusuyrrbV+eHYpkD8cdDLwabxzmFhn73RNmRUdu1Q@mail.gmail.com> |
On 3/6/16, Osamu TAKEUCHI <[email protected]> wrote: > I agree duplicate key should be detected by > YAML processors because we do not want users > to use duplicate keys for overwriting the > values of predefined keys. By "predefined key" do you mean "a key previously defined in this map"? Example 1: a statistics application wants to store a 'bunch' of mappings, of data point name, to value; in Java, if the YAML library uses a LinkedHashMap (as e.g. SnakeYaml and I think at least one other Java library does) then the application can simply serialize all these "histogram" pairs into a YAML map. A list of maps could be used instead of a map. Knowing Java, this feels more heavyweight than needed. Additional structure implies storage and processing cost. Example 2: Let's say we have an intended to be user-edited config file. The user enters duplicate key:value pairs in a YAML map. The application: - might be tolerant of this in some way, - might want to transparently remove the duplicate, - might want to log that this has happened, - might want to be noisy about this e.g. "WARNING: Your config file contains duplicate key/value pairs, namely "...", this violates the config file schema - correct the error and re-start the application." - might want to do other things ? Transparently ignoring or flagging this 'error' takes away options from the application - is it good to mandate this in the YAML spec, or is it better to leave this to YAML library implementers? > The key order in > a YAML mapping should not have meaning. Ack. Preservation of key order by the YAML library can be a desirable attribute for an application, and possibly desirable to be an option in certain cases (max performance deserialization). (I am not (yet) a YAML library implementer.) ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://makebettercode.com/inteldaal-eval