* Michael G Schwern <[EMAIL PROTECTED]> [2008-08-18T12:26:54]
> YAML types can be little more than local tags which only have meaning to that
> particular document.
>
> name: !customer Evil Business Guy Made Of Butter
Yeah, that's neat and everything, but there aren't any Perl implementations
that let you USE that feature.
When last I tried, I had to use YAML::Syck, which caused them to be blessed
into 'customer' and then rewrite and rebless them with a visitor.
libyaml offers this feature, but YAML::LibYAML does not, and I don't have much
reason to believe it's coming in the near? future.
> A TAP producer need not use a full YAML library, they can happily output JSON
> or even hand roll it. Only a TAP parser need concern itself with having a
> full YAML library. One of the complexity principles of TAP is to push
> complexity down from the human and the TAP producer into the TAP parser.
> There need only be a handful of parsers and there need not be one for each
> programming language.
...but there IS no full YAML library in Perl. YAML::LibYAML still blesses
things into a package named after their tag. It also doesn't properly parse
JSON...
my $json = q[ { "this-is-null": null } ];
use Data::Dumper;
print Dumper(Load($json));
$VAR1 = {
'this-is-null' => 'null'
};
...so, no. You can't just use a JSON emitter until someone writes or bugfixes
a Perl YAML parser.
YAML has lots of cool features. One of its chief authors is a prolific Perl
author. We still have no high-quality implementation of YAML for Perl. What
does that tell us about the future of YAML in other languages?
> JSON is a subset of YAML::Tiny, would you have had those problems with JSON?
> What were the problems?
No, YAML::Tiny is a DIFFERENT subset of YAML than JSON is.
use YAML::Tiny ();
print Dumper(YAML::Tiny->read_string($json));
$VAR1 = undef;
Also failing: true, false.
> Remember, YAML::Tiny can be extended. JSON can not.
That's a selling point for JSON, in my estimation, and a selling point for
"begin document; type={json,jpeg,zmachine,whatever}". Just mandate that the
only mandatory type for a compliant parser is JSON.
--
rjbs