Tels wrote :
-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On Sunday 26 June 2005 07:18, Collin Winter wrote:
[...]
After tinkering with B::Deparse for a bit, I think this particular
"oddity" may just be a result of poorly-written docs (or, more
probably, poorly-read on my part). The module seems to do the right
thing in all cases I could come up with (i.e., it only optimises out
truly-useless constants), so it should be safe to use for this
particular purpose. With this matter sorted, I've started on the code
and requisite tests to make the new stuff work.


Just for clarification: this means that:

        is_deeply( sub { 1 + 2; }, sub { 3; } );

should/will pass because the subs compile to the same code?

    is_deeply( sub {cos(0) + sqrt(4)}, sub {3} );

does as well, fwiw. So do looping constructs that map to the same thing:

    is_deeply(
        sub { my $x=0; $x += $_ for 1..10;        $x },
        sub { my $x=0; for( 1..10 ) { $x += $_ }; $x },
    );


Michael Schwern wrote at the beginning of this thread:

> What it *shouldn't* do is what Test.pm does, namely execute the
> code ref and compare the values returned.  It would just compare
> the refernces.

Why should it not do that? Is this because of subs with side effects? Isn't that more an issue of "Doctor, it hurts when I hit my knee with a hammer"?

David

Reply via email to