Hi!
Given two coderefs. Is there an (elegant) way to compare the code they're pointing to?
No, I don't need any fancy stuff like solving the halting problem. ;-) I do not even need to know if the code is equivalent. It would be completely sufficient if these
my $cr1 = sub { $foo = $bar * $baz; } my $cr2 = sub { $foo = $bar * $baz; }
Would be considered "same". Ideally with the whitespaces being irrelevant. All mutations, invariants etc. can safely be considered 'different'. i.e.
my $cr3 = sub { $mul = $op1 * $op2; } my $cr4 = sub { $foo = $baz * $bar; }
To sum up: It would be sufficient to have a function that - for two given coderefs (pointing to different addresses) - would just return "identic" if they'd be the same list of opcodes.
Howto? B:: something?
Thank you for your guidance.
Bye
PetaMem All Perl: MT, NLP, NLU
In reply to Compare CODE by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |