in reply to Re: Perl 6 will make amends (was:Perl's Bad Ideas)
in thread Perl's Bad Ideas
...is the statement part of a conditional in the same block as the body itself?
No, the conditional is outside the block, both physically and logically (err...physiologically? ;-).
Your example is equivalent to:
my $el; while ($el = pop @els) { # Body of loop }
BTW, in Perl 6, if and while (and the rest of the control structures) can be thought of as built-in functions. As if they were:
sub while (BOOL $condition, &closure) {...} sub if (BOOL $condition, &closure) {...}
That's why the conditional is not part of the block: it's an entirely separate argument to the control structure.
And, yes, you'll be able to get the signature (a.k.a. prototype) of a control structure, and overload it, and redefine it (lexically).
And you'll probably be able to write bad things like:
if condition(), &call_me;
and worse things like:
&debug := { if BEGIN{$debug}, &^action }; # and later... debug { print "here" }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (3): Perl 6 will make amends (was:Perl's Bad Ideas)
by shotgunefx (Parson) on Apr 07, 2002 at 21:35 UTC | |
by TheDamian (Vicar) on Apr 07, 2002 at 21:50 UTC | |
by shotgunefx (Parson) on Apr 07, 2002 at 22:12 UTC | |
by TheDamian (Vicar) on Apr 10, 2002 at 00:20 UTC | |
by shotgunefx (Parson) on Apr 10, 2002 at 00:59 UTC |
In Section
Meditations