[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [PATCH] Data::Dumper.pm



On Tue, Jan 11, 2000 at 10:41:52AM +0000, James Duncan wrote:
> Tim Bunce wrote:
> >   0 - warn and generate a sub { die ... }
> >   1 - warn and generate a sub { }
> >   2 - warn and output via B::Deparse
> >   3 - output via B::Deparse with no warning (except any from via B::Deparse)
> > 
> > Personally, I'd rather the default was 0.
> 
> I'd imagine that it would be better to maintain the current output
> (i.e., sub { "DUMMY" }) than suddenly have code dying in dumped data
> structures,

Sure, just make option 1 do that or add a new option 'between' 0 and 1.

> but option zero is definitely the path of least pain.

Yeap.

> > Of course ideally some of that functionality should live in B::Deparse.
> > It should be possible to ask B::Deparse to croak if it can't be reasonably
> > sure it's generated code will behave in the same way as the original.
> 
> I think B::Deparse is already *reasonably* sure that its generated code
> will behave the same way as the original. It works in test cases so the
> only time a real clanger will come along is when an exception crops up.
> Other than testing it in as many situations as possible I can't see any
> way that B::Deparse is going to become any more convinced that it's code
> will do the same thing as the original.

The to-do list alone convinces me that it's not *reasonably* sure.

> Perhaps Deparse could programmatically become sure that the syntax is ok
> by running it through eval, but beyond that I don't see it having many
> other options.

A test harness similar to perlcc is needed. For each existing t/*.t
test script that would compile, then deparse, then compile and execute
the deparse'd code. I think you'd be surprised how many tests wouldn't
even compile, let alone execute correctly.

Tim.


References to:
James Duncan <james@ebookers.com>
Gurusamy Sarathy <gsar@activestate.com>
Tim Bunce <Tim.Bunce@ig.co.uk>
James Duncan <james@ebookers.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]