Ovid wrote:
> --- Eric Wilhelm <[EMAIL PROTECTED]> wrote:
> 
>> I'm not sure the YAML spec distinguishes between string and number
>> when 
>> the string is a number.
>>
>>   $ perl -e 'use YAML; warn YAML::Dump([3,"3"]);'
>>   ---
>>   - 3
>>   - 3
>>   $ perl -e 'use YAML::Syck; warn YAML::Syck::Dump([3,"3"]);'
>>   ---
>>   - 3
>>   - 3
> 
> Ah, crud. Is this because YAML doesn't quote things without whitespace?
>  That really seems like a serious limitation to me.  Can I really keep
> a straight face and tell a C programmer that the "Test Anything
> Protocol" deliberately chose a serialization language that ignores data
> types?

YAML has data types.
http://en.wikipedia.org/wiki/YAML#Data_Types

Both implicit

        - 3     # integer
        - "3"   # string
        - 123.0 # float

And explicit

        - !!float 123   # float
        - !!str   123   # string

It can even do binary and user defined data types.

It's just that Perl, and almost everyone else in the universe, doesn't really
care if you have a string 3 or a number 3.

So you *can* dump out YAML with very detailed data types, but by default you
don't because it's just redundant junk that gets in the way.


-- 
Stabbing you in the face for your own good.

Reply via email to