Re: explicit non-specific-tag

Oren Ben-Kiki <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CADJiDhsYtqv1FfrV2AaNXYzGUm6DjPFByc1V0pgpDLZBtPOM3Q@mail.gmail.com>
Yes, ! 12 should be a string and not an integer. However, few YAML libraries
are up to the spec...
It is only needed if the plain scalar would otherwise be caught by an
implicit tagging rule.
It is never required because you have plenty of alternatives (the simplest
being quoting the scalar).

Have fun,

Oren Ben-Kiki

On Wed, Jul 27, 2011 at 5:47 PM, Trans <[email protected]> wrote:

> Hi--
>
> Section 6.28 in spec has:
>
>    # Assuming conventional resolution:
>    - "12"
>    - 12
>    - ! 12
>
> Two questions.
>
> 1) What is this last seq element, the "explicit non-specific-tag",
> supposed to resolve to?
>
> The spec says: !<tag:yaml.org,2002:str> "12", but when I run this
> through Ruby's Psych lib, which uses libyaml, it is coming back as
> an !!int:
>
>    > YAML.load('- ! 12')
>    => [12]
>
> I think that might be right and spec wrong. But then:
>
>    > YAML.load('- ! "12"')
>    => [12]
>
> Is that right?
>
> 2) When MUST an explicit non-specific-tag be used?
>
> I ask b/c I noticed libyaml is putting such a tag on every !!str node
> that has characters that need to be escaped. As it seems to be
> completely unnecessary, and make the output less human-readable, I do
> not understand why it is being done.
>
>
>
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core
>

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey

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