On Mon, Nov 21, 2005 at 03:51:19PM +0000, Luke Palmer wrote:
: On 11/21/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
: > Of course, the compiler is free to optimize these things if it can prove
: > that runtime's &statement_control:<if> is the same as the internal
: > optimized &statement_control:<if>.
: Which it definitely can't without some pragma.
But remember that on some level or other, all declarations function as
pragmas. So the absence of a redeclaration of "if" could be taken as
a kind of pragma, if we require control redefinition to be lexically
scoped, which we probably should.
: I wonder if they should be macros. (Macros that would by default
: expand to things that aren't expressible in Perl 6)
Which is another way of saying that control redefinitions should be
lexically scoped, since macros are required to do lexically scoped
syntax modification unless they're Preluditudinous.
Another issue in "if" optimization is whether the blocks in fact do
anything blockish that have to be scoped to the block. This is a
determination that Perl 5 makes when it's compiling blocks. It's
basically an attribute that migrates up the tree from the leaves, which
are mostly "true", but anyone in the block can falsify the attribute
for the block as a whole.
Arguably, when you use ??!! and friends, it should also be doing such
analysis on the lazy bits and telling you that your "my" is badly
scoped if it's in conditional code. That also catches
my $x = 0 if rand 2;