develooper Front page | perl.perl6.language | Postings from August 2006

[patch] do EXPR

From:
Agent Zhang
Date:
August 15, 2006 05:11
Subject:
[patch] do EXPR
Message ID:
c711ff240608150511n6e6abae2q4f9ffad6a3b8e733@mail.gmail.com
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About