Re: YAML 2.0: drop arbitrary nodes to be used as keys
Geoff Adams <[email protected]> Wed, 2 Mar 2016 12:06:05 -0500
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CA+n7TG9D3sy988bEqnpXrp03SJA+m=P=ezFwWRDxDouik92aRQ@mail.gmail.com> |
I wrote a libyaml wrapper for Matlab, a language which doesn't even have a real native mapping type (or didn't until very recently, and it's sort of kludged on), meaning there's no native type to easily represent mappings with scalar keys which aren't strings. However, the most common YAML mappings, with scalar string keys, can be naturally represented with Matlab's struct type, and 95% of the time this is definitely what the user wants. I chose to provide a generic representation, where YAML mappings are represented in Matlab as a list (cell array in Matlab parlance) of key-value pairs, as well as a specialized representation for those mappings which Matlab can represent as structs, and allowed the user to select which is appropriate for the application. This same strategy is applied for non-scalar keys. I think this is a more appropriate strategy for parsers in languages which do not offer a simple native-type representation of non-scalar mappings (or any other useful YAML feature). If your users are telling you you need to change your YAML because they can't parse it, the problem is that their parser is not standards-compliant, not that the full YAML spec is impossible to implement in their language. Any language that offers at least nested mixed-type lists (or some other representation of a mixed-type tree) should be able to represent any YAML document, even if that representation is less "natural" than it would be in a different language. Short version, don't drop useful features from YAML 2.0 just because they're inconvenient to implement in some languages. If it can work in the arbitrary mess that is Matlab, it can work in your language. Best, Geoff On Wed, Mar 2, 2016 at 11:27 AM, Andrey Somov <[email protected]> wrote: > Dear Osamu, > >In YAML 1.2, the spec says > > Please be aware that YAML 1.2 does not really exist. It is completely > ignored by the industry. > Even though it was released many years ago there is still no parser which > implements it. > > I only know 2 parsers which _partially_ implement YAML 1.2 > > > >Could you point out the importance of inter-operability > >if I do not understand it correctly. > > I will try to define what is inter-operability for me (as a developer of a > general purpose YAML parser) > > If I have YAML document I can give it to anybody else. > They apply their context, they parse it with their programming language. > And they do not come back to me saying that I must change my YAML because > they cannot do anything. > The above is valid for XML or JSON, but completely invalid for YAML. > > SnakeYAML issues are full with complains that users cannot work with YAML > produced by another parser. > Why a developer should explain to the community the deficiencies of the > specification ? > > If you produce and consume YAML yourself then it works. Is it what we want > ? > > Cheers, > Andrey > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > _______________________________________________ > Yaml-core mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/yaml-core > > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core