in reply to Puzzle: Whats wrong with Dumper

This is the bug I reported many moons ago, and has not been fixed yet, which I found while I was writing my safe undumper column.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Puzzle: Whats wrong with Dumper
by demerphq (Chancellor) on May 17, 2002 at 16:27 UTC
    So it appears. :-)

    I am well aware of your bug report (its a test case for my BFDump) but for various reasons I had this one down as a seperate issue. :-)

    Incidentally to answer your (implicit) question from the bug report:

    I'm not sure how to fix this... you really need to dump $dogs before $kennel here so you can take a reference to the array element in place. Or it has to be patched up afterward. I'm turning Purity on, which is usually pretty good about constructing the patchups. But it wasn't sufficient here.

    Theres a simple way to solve this problem, but nobody will like it: Dumper must make two passes over the data structure. The first to identify every variable in the data structure, the second to actually dump the structure using that data.

    I leave it as an excercise for the reader to see why it is impossible to dump any arbiitrary perl data structure with only one pass (as Dumper attempts to do).

    Incidentally BFDump does handle your perl5-porter bug, but doesnt handle this one (yet).

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.