Re: YAML 2.0: drop arbitrary nodes to be used as keys

flyx <[email protected]> Wed, 02 Mar 2016 15:46:11 +0100
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On 2016-03-02 13:27, Andrey Somov wrote:
>> No. Tuples are immutables in Python, and can be used as keys in
> Python dictionaries.
> This is exactly the message I would like to prevent.
> (background - I used PyYAML a lot, as well as SnakeYAML)
> The message: it must be in YAML because it is supported by
> _my_language_.

On the contrary: Complex objects (structs, records, classes, tuples, 
however they are named) are part of most programming languages, and it 
is fine to use them as mapping keys. So YAML should support them (see my 
other answer for an example).

> It means that YAML ends up with every dirty trick ever invented for
> any programming language. Do we want that ?

This is a slippery slope argument. No-one said that YAML should do that, 
you are just jumping to conclusions.

> Do not we suffer now from the result of trying to put any hack to the
> specification (1:2 is integer !!!)?
> Should we think about inter-operability ?
> We should not implement things because it is possible, we should
> implements things which are useful.
> If we take only one language (regardless which one), then I am off.
> (because then YAML is useless for me)

Nobody wants YAML to be bound to a specific language.

> All the public YAML (which I know) does not use complex keys.
> 
> - ansible
> - google engine
> - testNG
> - RAML
> - polyglot Maven
> 
> Can anyone show an example of the public usage of YAML with  a complex
> key ?

This is not relevant for two reasons:

Firstly, YAML was designed as a serialization language. The examples you 
show mostly (afaik) use YAML as configuration language. Therefore, they 
are not optimal examples of usage of YAML in the wild. In cases where 
YAML is used as serialization languages, the user is not necessarily 
exposed to the generated YAML character stream, so you might not even 
know that YAML is used. While it might be true that complex keys are 
unusual for configuration files, this does not mean that they are not 
useful for serialization purposes - YAML's primary objective.

Secondly, allowing this argument would create a chicken-and-egg-problem: 
Features cannot be introduced in YAML because no-one uses them, and 
no-one uses them because they are not specified.


Cheers,
Felix

------------------------------------------------------------------------------
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