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

flyx <[email protected]> Wed, 02 Mar 2016 12:25:03 +0100
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On 2016-03-02 11:23, Andrey Somov wrote:
Hi all,
even though it looks like a powerful feature, it gives nothing.

I tend to differ.

The reason is that it must never be used. YAML should not advocate
collections (often mutable data structures) as keys.

You are making arbitrary assumptions on what sequences or mappings 
represent. A mapping may perfectly represent a complex structure 
(„struct“, „class“, „record“ in some languages). As a minimal example, 
let's have a look at complex numbers: They have a real and an imaginary 
part. Now if one wants to have a mapping with complex numbers as keys, 
it may look like this:

     {real: 1, imaginary: 0}: foo
     {real: 0, imaginary: 1}: bar

Is this not useful? Would you rather want the implementor to craft an 
arbitrary serialization spec to represent complex numbers as scalars? Or 
forbid them as mapping keys because they are not scalars? YAML is not a 
useful serialization language if you need to pre-serialize complex 
values so that they fit into YAML's object model.

Cheers,
Felix


PS: I initially sent this only to Andrey, sorry. Same points have been 
made by others since.

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