Re: The same tag for different kinds

Oren Ben-Kiki <[email protected]> Fri, 11 Mar 2016 10:36:19 +0200
Newsgroups gmane.text.yaml.general
Message-ID <CADJiDhtgddHuFYir=dAj5yqqjF1Py_4x1tDZ2ncguYYAaeUc8Q@mail.gmail.com>
Technically the library should reject an attempt to register the same tag
with different kinds...

Something like resolvers[tag] = { required-kind: ..., condition-on-path:
..., condition-on-content: ..., construction-function: ... } would provide
the correct data model.

Oren.

On Fri, Mar 11, 2016 at 10:18 AM, Andrey Somov <[email protected]>
wrote:

>
>
> On Fri, Mar 11, 2016 at 1:30 AM, Oren Ben-Kiki <[email protected]> wrote:
>
>> Presumably complain. What would it do with !!int {} ?
>>
>
> Yes, thank you. This is what I would like.
> With the standard tags there is no question, it is a matter of consistency.
> But for the _custom tags_ this is unclear in the specification (at least
> for me).
>
> At the moment SnakeYAML, PyYAML (and probably other processors) let users
> define custom tags by providing a function Node => Object which is invoked
> when the
> custom tag is detected.
> The interface is approx. like this:
> register(<tag>, function<node => Object>)
>
> Then this interface is incomplete. Registering the function _must_ specify
> the node kind
> register(<kind>, <tag>, function<node => Object>)
>
> It also means that user may specify 3 different functions for each tag.
>
> I think it is worth to mention it in the YAML 2.0 spec for clarity.
>
> Andrey
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core
>
>

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core