Re: Option to enforce unique map keys

"Roy Brokvam (Dossier)" <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Isn't this an implementation issue? I don't see any reasons a composer shouldn't be able to detect duplicate keys, even when streaming (providing the composer remembers previous keys of the same mapping).

That implementing such a composer is a complex task is another matter.

> On 4. okt. 2014, at 17:38, Mark Laff <[email protected]> wrote:
> 
>> On 23 Sep 2014 [email protected] wrote:
>> 
> 
>> The transformation of YAML from text to memory objects, is called "Load"ing and involves a stack of distinct layers. Likely: Reader→Lexer→Parser→Composer→Constructor.
>> 
>> The spec is trying to say that the data model of YAML "mappings" does not account for duplicate keys.
>> Detection of duplicate keys can't really be detected by the parser. This is for a couple reasons:
>> It is not realistic for a parser to keep keys as state. A parser looks at a token stream and generates events.
>> Not all keys are strings, or numbers. A key can be any graph node (including a mapping or sequence).
>> Even when keys are strings they can be different and be duplicate. ie:
>> 12: dozen
>> XII: Roman dozen
>> Those can become duplicate keys up the stack. Thus this detection has to happen further up the stack. That's why the implementations built over libyaml can't rely on libyaml to report duplicate keys as errors. Not possible.
>> In streaming processing of YAML, stuff doesn't go any higher up the stack than the parser. So it would be the application's responsibility to detect the duplicates.
> 
> 
> I understand your point, and hadn't thought about the decomposition of the YAML process.
> 
> So...given that some users would like to detect duplicate keys, perhaps this option should be added to the Constructor.
> 
> 
> Mark 
> --
> Mark Laff
> [email protected]
> 914-262-0419 [mobile]
> 914-232-1020 [home office]
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.