NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Example of why this is hard (Score:1)
For the benefit of others reading your journal that don't fully understand why this is probably not an easy thing to do....
sub double { 2 * $_[0] }Seems straight forward enough and shouldn't have any side effects. Hrm, what if $_[0] is an alias to a tied variable. What if the FETCH method of that variable has action at a distance. Can't tell just by looking at the source :-(
Re: (Score:1)
Something Alias taught me with PPI is that analyzing Perl source is so dang hard partially because of the potentially hidden external factors that can change what a particular line means.
What you've shown extremely well above is that a document parser is probably the wrong way to do side-effect analysis.
Re: (Score:1)
I don't think the optree holds that information, as it's the opcodes themselves that have to check for magic. At compile time, Perl doesn't know if you'll pass in a variable with magic.
Re: (Score:1)
Re: (Score:1)
Re: (Score:1)
Re: (Score:1)
Re: (Score:1)
Then again, I need to brush up on my internals knowledge before I make any more pi-in-the-sky proposals.
Re: (Score:1)
It's really, really hard to do anything meaningful in Perl that doesn't have side-effects.
Re: (Score:1)
Re: (Score:1)
Yes. The first thing that comes to mind is that it may affect the behaviour of the bitwise ops. There are more examples of subtle effects; I can’t think of them right now, but I know I used to know about them.