在 Oct 4, 2006 10:17 AM 時,Damian Conway 寫到:
Audrey asked:
However, I wonder if this is too strict. Disallowing "while" and
"until" after a do block is fine (and can be coded directly in those
two statement modifier macros), but is there a reason to disallow
other modifiers?
Well, for a start, there's this syntactic problem:
do { say "vale, munde asper"; mori(); }
if $lang eq 'Latinus';
*nod* The use case here is
do { .foo for @bar } if $baz;
But I guess you can always "protect" it with a parens:
(do { .foo for @bar }) if $baz;
Which also makes the syntactic problem go away. So indeed,
disallowing statement modifiers after do{} altogether seems sane.
Thanks!
Audrey