Change 34451 by [EMAIL PROTECTED] on 2008/10/01 08:55:48
error reporting of [$a ; $b] can be a TODO.
Affected files ...
... //depot/perl/pod/perltodo.pod#241 edit
Differences ...
==== //depot/perl/pod/perltodo.pod#241 (text) ====
Index: perl/pod/perltodo.pod
--- perl/pod/perltodo.pod#240~34307~ 2008-09-07 07:11:40.000000000 -0700
+++ perl/pod/perltodo.pod 2008-10-01 01:55:48.000000000 -0700
@@ -845,6 +845,23 @@
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:
End of Patch.