Re: Why is foo: 1:2:3:4 an integer in yaml?

Ingy dot Net <[email protected]> Sat, 2 Apr 2016 17:48:48 -0700
Newsgroups gmane.text.yaml.general
Message-ID <CAHJtQJ4O9bSB3fLwKXifLEhCVksRmyi=JKsHF5Hjr0g5wCdPGg@mail.gmail.com>
The python one is 1*60^3+2*60^2+3*60^1+4*60^0. Not sure about the Ruby one.
Perl would be the string '1:2:3:4'.

Welcome to the sexagesimal debacle of YAML implicit typing.
Specifically: [-+]?[1-9][0-9_]*(:[0-5]?[0-9])+
*# (base 60)*

Back in 2005ish we made up a bunch of types that unquoted scalars should be
cast to: http://yaml.org/type/

Later we (yaml core) decided that the default type resolution should match
JSON, but we never took down the type info. This has led to much bugginess
in scalar typing.

Hopefully we can get schema related guidelines locked down in YAML 1.3.

On Fri, Apr 1, 2016 at 10:38 AM, Aimon Bustardo <[email protected]> wrote:

> Hi, I am trying to figure out an oddity (at least to me) in YAML. Why is
> foo: 1:2:3:4 seen as an integer and what is it doing to calculate? It is
> different between languages as seen below:
>
> Ruby:
> irb(main):003:0> YAML.load('foo: 1:2:3:4')
> => {"foo"=>3963}
>
> Python:
>  >>> print yaml.load('foo: 1:2:3:4')
>  >>> {'foo': 223384}
>
>
> Thanks.
>
>
>
>
> ------------------------------------------------------------------------------
> 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=278785471&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=278785471&iu=/4140

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