in reply to Re: Playing with (macro/source-filter) fire
in thread Playing with (macro/source-filter) fire
while I get...MACRO (COMPILED & DEPARSED): while ($var3 < $cons4) { $body6; } continue { ++$var5 }
...I notice that the first line $var1 = $cons2; is missing in your report. And strangely enough there's a line is missing from your compilied and deparsed source code ...MACRO (COMPILED & DEPARSED): $var1 = $cons2; while ($var3 < $cons4) { $body6; } continue { ++$var5 }
vs. my machineSOURCE (COMPILED & DEPARSED): my $x; while ($x < 8) { my $f = fact($x); print "factorial($x)=$f\n"; } continue { ++$x } sub fact { $_[0] <= 0 and return 1; return $_[0] * fact($_[0] - 1); } '???';
...the $x = 0; has gone missing. So this causes $reorder to differ...SOURCE (COMPILED & DEPARSED): my $x; $x = 0; while ($x < 8) { my $f = fact($x); print "factorial($x)=$f\n"; } continue { ++$x } sub fact { $_[0] <= 0 and return 1; return $_[0] * fact($_[0] - 1); }
vs.REORDER: $var3 = $1;$cons4 = $2;$body6 = $3;$var5 = $4;
and is probably what causes the substitution match failure and thus you get the original code back. I don't know why lines would suddenly dissapear. Is it a buffering problem with the back-tick operator?REORDER: $var1 = $1;$cons2 = $2;$var3 = $3;$cons4 = $4;$body6 = $5;$va +r5 = $6;
update:I'd try just running...
perl -MO=Deparse,-x9 -e'for($i=0;$i<10;$i++){$x++}'
...all by itself and see if it matches...
That's straight from 3rd edition camel p. 480. Anyone else have any ideas? BTW, I'm running perl 5.6.1 under Slackware Linux$i = 0; while ($i < 10) { ++$x; } continue { ++$i }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strange differences...
by stvn (Monsignor) on Jan 23, 2004 at 21:58 UTC |