Re: The same tag for different kinds

Oren Ben-Kiki <[email protected]> Thu, 10 Mar 2016 21:21:42 +0200
Newsgroups gmane.text.yaml.general
Message-ID <CADJiDhs5a-YmLc8tAN=WP6gF6Zz5_4_SzOKGBixOgqHVj66mvg@mail.gmail.com>
On Thu, Mar 10, 2016 at 7:10 PM, Andrey Somov <[email protected]>
wrote:

> The tag itself does not give any indication which node kind it needs.
>

What do you mean? The spec requires certain things from each tag, this is
one.


> Or "each tag must specify the expected node kind" must be read as "each
> tag can only be applied to the node kind it is used with" ?
>

Yes.


> My question is: should the parser be prepared to get a custom tag for
> different kinds ?
> Should the parser allow to configure to call different custom
> implementations for different kinds for the same tag ?
>

I'm assuming you are misusing the word parser here. A YAML processor that
constructs native application data needs to (1) associate tags with all
nodes and (2) map the tags to native data types and (3) then construct them.

There's no requirement that different tags map to different native data
types (e.g., in JavaScript, !!int and !!float map to the same native number
type).

YAML requires that tags-that-are-associated-with-scalar-nodes be different
than tags-that-are-associated-with-map-nodes which must be different than
tags-that-are-associated-with-sequence-nodes.

BTW, since tags are URIs, one can do things like !!foo#scalar vs. !!foo#map
vs. !!foo#seq to communicate they are related. Or use `/` or `::` or `-` or
whatever.

Oren.

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