Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[patch] do EXPR

6 views
Skip to first unread message

Agent Zhang

unread,
Aug 15, 2006, 8:11:46 AM8/15/06
to p6l
Hello~

Here is a snippet from the Pugs test suite:

{
my $ret = eval 'do 42';
ok(!$ret, 'do EXPR should not work', :todo);
# XXX or should it? Feels weird...
}

which motivated me to create the following patch for S04:

Index: D:/projects/Perl6-Syn/S04.pod

===================================================================

--- D:/projects/Perl6-Syn/S04.pod (revision 10955)

+++ D:/projects/Perl6-Syn/S04.pod (working copy)

@@ -349,8 +349,9 @@


$x = do if $a { $b } else { $c };

-This construct only allows you to prefix a statement. If you want to
-continue the expression after the statement you must use the curly form.
+This construct only allows you to prefix I<one> statement (or an expression).
+If you want to continue the expression after the statement you must use the
+curly form.

Since C<do> is defined as going in front of a statement, it follows
that it can always be followed by a statement label. This is particularly


Cheers,
Agent

0 new messages