Open wolfsage opened 2 years ago
Should it dump fields? Would be useful but that's private data unless explicitly exposed? Hmm.
Should it dump fields? I don't know. Data::Dumper
is duty-bound to only print valid perl code that theoretically someone could eval()
again to recreate a decent approximation to the original value that was passed in.
Example, in this case:
class HiddenField {
field $x; ADJUST { $x = int( rand * 256 ) }
}
my $obj = HiddenField->new;
Dumper($obj)
what valid perl code should be printed? What can you possibly eval()
again to recreate that object?
This was touched on by https://github.com/Ovid/Cor/issues/63
Alternative thought: Data::Dumper being duty-bound to print valid eval()
-able Perl code, means it cannot and should never support this. We should train users out of expecting to use Data::Dumper just to get some human-readable debug printing, and instead supply them with a better (core-supported) mechanism that doesn't have that restriction. Something like Data::Printer perhaps.