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

Zenaan Harkness <[email protected]> Thu, 3 Mar 2016 13:34:14 +0000
Newsgroups gmane.text.yaml.general
Message-ID <CAOsGNSS3TWz7C4j1Pp4SY9eiaib1s24tEo4AdBcFJwjxbU0cAA@mail.gmail.com>
On 3/2/16, Peter Murphy <[email protected]> wrote:
> On Wed, Mar 2, 2016 at 8:23 PM, Andrey Somov <[email protected]>
> wrote:
>> Hi all,
>> even though it looks like a powerful feature, it gives nothing.
>>
>> This should be removed:
>> Note that YAML allows arbitrary nodes to be used as keys. In particular,
>> a
>> key may be a sequence or a mapping. Thus, without the above restrictions,
>> practical one-pass parsing would have been impossible to implement.
>>
>> The reason is not that it makes it impossible to convert YAML to JSON.
>> The reason is that it must never be used. YAML should not advocate
>> collections (often mutable data structures) as keys.
>> Of course, the related restrictions, like "1024 rule" or  "key is
>> restricted
>> to a single line", are also gone.
>> The key must be a scalar. Point. Whatever it is.
>
> No. Tuples are immutables in Python, and can be used as keys in Python
> dictionaries. There are also immutable sets in Python, which can map
> as a dictionary where all the matching values are null. There are
> Python parser (like PyYAML) which happily deal with the expanded
> nature of "keys".

Likewise in Java there are no limitations as to the types that can be
used as keys.

> Please. No.

Likewise, please no. For greater enforced simplicity, JSON is (I
think) your friend - but even there, I've always preferred YAML's
"cleaner" look.

Regards,
Zenaan

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