From: Nicholas Clark Date: Wed, 1 Oct 2008 08:55:48 +0000 (+0000) Subject: error reporting of [$a ; $b] can be a TODO. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=565590b5d66dafeef2ec402e8f2aecb5e1fc2a60;p=p5sagit%2Fp5-mst-13.2.git error reporting of [$a ; $b] can be a TODO. p4raw-id: //depot/perl@34451 --- diff --git a/pod/perltodo.pod b/pod/perltodo.pod index 7a1a48a..558921c 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -845,6 +845,23 @@ also the warning messages (see L, C). These tasks would need C knowledge, and knowledge of how the interpreter works, or a willingness to learn. +=head2 error reporting of [$a ; $b] + +Using C<;> inside brackets is a syntax error, and we don't propose to change +that by giving it any meaning. However, it's not reported very helpfully: + + $ perl -e '$a = [$b; $c];' + syntax error at -e line 1, near "$b;" + syntax error at -e line 1, near "$c]" + Execution of -e aborted due to compilation errors. + +It should be possible to hook into the tokeniser or the lexer, so that when a +C<;> is parsed where it is not legal as a statement terminator (ie inside +C<{}> used as a hashref, C<[]> or C<()>) it issues an error something like +I<';' isn't legal inside an expression - if you need multiple statements use a +do {...} block>. See the thread starting at +http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-09/msg00573.html + =head2 lexicals used only once This warns: