On 15/04/02 19:24 -0700, Neil Watkiss wrote:
> Brian Ingerson [15/04/02 19:06 -0700]:
> So in libyaml's case, I would do it "the former" way, not the latter. That's
> because it really implements a stream -- you can't unstream something. How do
> other serializers do this: Data::Dumper, cPickle, etc?
Data::Dumper can always refer back because it has the "root anchor", $VAR1.
This is not without its edge cases. Data::Dumper does not prewalk the tree,
but Sarathy has said that it probably should.
Time to be philosophical: "No serializer is perfect". The closest you can
come to pure data accuracy is to dump/restore core memory. This ends up being
far from perfect in human readability.
YAML hits a sweet-spot between human readability and data accuracy. It highly
values both, but is perfect in neither.
Some of this accuracy lies outside the spec, IMO. For instance, YAML.pm does
not preserve aliases between leaves. That's because I think that humans do
not like serializations that look like this:
- &001 yes
- &002 no
You may say I'm breaking the rules, but I'll disagree. I'm merely choosing
not to preserve a probably uninteresting data relationship to improve
usability. I could easily add a Purity option. But I wouldn't make it the
There are plenty of other attributes that YAML won't readily preserve. Like
the fact that a leaf was READONLY. I could dump leaves as (perl internal) SV
structs in a special YAML class, but I don;t think the masses would
Just rambling, Brian