From: Nicholas Clark Date: Thu, 13 Sep 2007 14:52:20 +0000 (+0000) Subject: Note that list initialisation of state variables is TODO. While in the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=636e63cb2d86040c1b02edfaea110c6993a0b8de;p=p5sagit%2Fp5-mst-13.2.git Note that list initialisation of state variables is TODO. While in the area, note how B::Deparse might be improved to name inlined constants. p4raw-id: //depot/perl@31863 --- diff --git a/pod/perltodo.pod b/pod/perltodo.pod index d981521..1095a72 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -87,6 +87,28 @@ tests that are currently missing. A full test suite for the B module would be nice. +=head2 Deparse inlined constants + +Code such as this + + use constant PI => 4; + warn PI + +will currently deparse as + + use constant ('PI', 4); + warn 4; + +because the tokenizer inlines the value of the constant subroutine C. +This allows various compile time optimisations, such as constant folding +and dead code elimination. Where these haven't happened (such as the example +above) it ought be possible to make B::Deparse work out the name of the +original constant, because just enough information survives in the symbol +table to do this. Specifically, the same scalar is used for the constant in +the optree as is used for the constant subroutine, so by iterating over all +symbol tables and generating a mapping of SV address to constant name, it +would be possible to provide B::Deparse with this functionality. + =head2 A decent benchmark C seems impervious to any recent changes made to the perl core. It @@ -526,6 +548,19 @@ calls during startup, and (by implication) a bit of tweaking of that order. These tasks would need C knowledge, and knowledge of how the interpreter works, or a willingness to learn. +=head2 state variable initialization in list context + +Currently this is illegal: + + state ($a, $b) = foo(); + +The current Perl 6 design is that C and +C<(state $a) = foo();> have different semantics, which is tricky to implement +in Perl 5 as currently the produce the same opcode trees. It would be useful +to clarify that the Perl 6 design is firm, and then implement the necessary +code in Perl 5. There are comments in C that show the +code paths taken by various assignment constructions involving state variables. + =head2 Implement $value ~~ 0 .. $range It would be nice to extend the syntax of the C<~~> operator to also