📄 perltodo.1
字号:
Investigate trade offs to switch out perl's choices on memory usage.Particularly perl should be able to give memory back..PPThis task is incremental \- even a little bit of work on it will help..ie n .Sh "Re-implement "":unique"" in a way that is actually thread-safe".el .Sh "Re-implement \f(CW:unique\fP in a way that is actually thread-safe".IX Subsection "Re-implement :unique in a way that is actually thread-safe"The old implementation made bad assumptions on several levels. A good 90%solution might be just to make \f(CW\*(C`:unique\*(C'\fR work to share the string bufferof SvPVs. That way large constant strings can be shared between ithreads,such as the configuration information in \fIConfig\fR..Sh "Make tainting consistent".IX Subsection "Make tainting consistent"Tainting would be easier to use if it didn't take documented shortcuts andallow taint to \*(L"leak\*(R" everywhere within an expression..Sh "readpipe(\s-1LIST\s0)".IX Subsection "readpipe(LIST)"\&\fIsystem()\fR accepts a \s-1LIST\s0 syntax (and a \s-1PROGRAM\s0 \s-1LIST\s0 syntax) to avoidrunning a shell. \fIreadpipe()\fR (the function behind qx//) could be similarlyextended..Sh "Audit the code for destruction ordering assumptions".IX Subsection "Audit the code for destruction ordering assumptions"Change 25773 notes.PP.Vb 5\& /* Need to check SvMAGICAL, as during global destruction it may be that\& AvARYLEN(av) has been freed before av, and hence the SvANY() pointer\& is now part of the linked list of SV heads, rather than pointing to\& the original body. */\& /* FIXME \- audit the code for other bugs like this one. */.Ve.PPadding the \f(CW\*(C`SvMAGICAL\*(C'\fR check to.PP.Vb 2\& if (AvARYLEN(av) && SvMAGICAL(AvARYLEN(av))) {\& MAGIC *mg = mg_find (AvARYLEN(av), PERL_MAGIC_arylen);.Ve.PPGo through the core and look for similar assumptions that SVs have particulartypes, as all bets are off during global destruction..Sh "Extend PerlIO and PerlIO::Scalar".IX Subsection "Extend PerlIO and PerlIO::Scalar"PerlIO::Scalar doesn't know how to \fItruncate()\fR. Implementing thiswould require extending the PerlIO vtable..PPSimilarly the PerlIO vtable doesn't know about formats (\fIwrite()\fR), orabout \fIstat()\fR, or \fIchmod()\fR/\fIchown()\fR, \fIutime()\fR, or \fIflock()\fR..PP(For PerlIO::Scalar it's hard to see what e.g. mode bits or ownershipwould mean.).PPPerlIO doesn't do directories or symlinks, either: \fImkdir()\fR, \fIrmdir()\fR,\&\fIopendir()\fR, \fIclosedir()\fR, \fIseekdir()\fR, \fIrewinddir()\fR, \fIglob()\fR; \fIsymlink()\fR,\&\fIreadlink()\fR..PPSee also \*(L"Virtualize operating system access\*(R"..Sh "\-C on the #! line".IX Subsection "-C on the #! line"It should be possible to make \-C work correctly if found on the #! line,given that all perl command line options are strict \s-1ASCII\s0, and \-C changesonly the interpretation of non-ASCII characters, and not for the script filehandle. To make it work needs some investigation of the ordering of functioncalls during startup, and (by implication) a bit of tweaking of that order..Sh "Propagate const outwards from \fIPerl_moreswitches()\fP".IX Subsection "Propagate const outwards from Perl_moreswitches()"Change 32057 changed the parameter and return value of \f(CW\*(C`Perl_moreswitches()\*(C'\fRfrom <char *> to <const char *>. It should now be possible to propagateconst-correctness outwards to \f(CW\*(C`S_parse_body()\*(C'\fR, \f(CW\*(C`Perl_moreswitches()\*(C'\fRand \f(CW\*(C`Perl_yylex()\*(C'\fR..Sh "Duplicate logic in \fIS_method_common()\fP and \fIPerl_gv_fetchmethod_autoload()\fP".IX Subsection "Duplicate logic in S_method_common() and Perl_gv_fetchmethod_autoload()"A comment in \f(CW\*(C`S_method_common\*(C'\fR notes.PP.Vb 7\& /* This code tries to figure out just what went wrong with\& gv_fetchmethod. It therefore needs to duplicate a lot of\& the internals of that function. We can\*(Aqt move it inside\& Perl_gv_fetchmethod_autoload(), however, since that would\& cause UNIVERSAL\->can("NoSuchPackage::foo") to croak, and we\& don\*(Aqt want that.\& */.Ve.PPIf \f(CW\*(C`Perl_gv_fetchmethod_autoload\*(C'\fR gets rewritten to take (more) flag bits,then it ought to be possible to move the logic from \f(CW\*(C`S_method_common\*(C'\fR tothe \*(L"right\*(R" place. When making this change it would probably be good to alsopass in at least the method name length, if not also pre-computed hash valueswhen known. (I'm contemplating a plan to pre-compute hash values for commonfixed strings such as \f(CW\*(C`ISA\*(C'\fR and pass them in to functions.).Sh "Organize error messages".IX Subsection "Organize error messages"Perl's diagnostics (error messages, see perldiag) could usereorganizing and formalizing so that each error message has itsstable-for-all-eternity unique id, categorized by severity, type, andsubsystem. (The error messages would be listed in a datafile outsideof the Perl source code, and the source code would only refer to themessages by the id.) This clean-up and regularizing should applyfor all \fIcroak()\fR messages..PPThis would enable all sorts of things: easier translation/localizationof the messages (though please do keep in mind the caveats ofLocale::Maketext about too straightforward approaches totranslation), filtering by severity, and instead of grepping for aparticular error message one could look for a stable error id. (Ofcourse, changing the error messages by default would break all theexisting software depending on some particular error message...).PPThis kind of functionality is known as \fImessage catalogs\fR. Look forinspiration for example in the \fIcatgets()\fR system, possibly even use itif available\*(-- but \fBonly\fR if available, all platforms will \fBnot\fRhave \fIcatgets()\fR..PPFor the really pure at heart, consider extending this item to coveralso the warning messages (see perllexwarn, \f(CW\*(C`warnings.pl\*(C'\fR)..SH "Tasks that need a knowledge of the interpreter".IX Header "Tasks that need a knowledge of the interpreter"These tasks would need C knowledge, and knowledge of how the interpreter works,or a willingness to learn..Sh "\s-1UTF\-8\s0 revamp".IX Subsection "UTF-8 revamp"The handling of Unicode is unclean in many places. For example, the regexpengine matches in Unicode semantics whenever the string or the pattern isflagged as \s-1UTF\-8\s0, but that should not be dependent on an internal storagedetail of the string. Likewise, case folding behaviour is dependent on the\&\s-1UTF8\s0 internal flag being on or off..Sh "Properly Unicode safe tokeniser and pads.".IX Subsection "Properly Unicode safe tokeniser and pads."The tokeniser isn't actually very \s-1UTF\-8\s0 clean. \f(CW\*(C`use utf8;\*(C'\fR is a hack \-variable names are stored in stashes as raw bytes, without the utf\-8 flagset. The pad \s-1API\s0 only takes a \f(CW\*(C`char *\*(C'\fR pointer, so that's all bytes too. Thetokeniser ignores the UTF\-8\-ness of \f(CW\*(C`PL_rsfp\*(C'\fR, or any SVs returned fromsource filters. All this could be fixed..Sh "state variable initialization in list context".IX Subsection "state variable initialization in list context"Currently this is illegal:.PP.Vb 1\& state ($a, $b) = foo();.Ve.PPIn Perl 6, \f(CW\*(C`state ($a) = foo();\*(C'\fR and \f(CW\*(C`(state $a) = foo();\*(C'\fR have differentsemantics, which is tricky to implement in Perl 5 as currently they producethe same opcode trees. The Perl 6 design is firm, so it would be good toimplement the necessary code in Perl 5. There are comments in\&\f(CW\*(C`Perl_newASSIGNOP()\*(C'\fR that show the code paths taken by various assignmentconstructions involving state variables..ie n .Sh "Implement $value\fP ~~ 0 .. \f(CW$range".el .Sh "Implement \f(CW$value\fP ~~ 0 .. \f(CW$range\fP".IX Subsection "Implement $value ~~ 0 .. $range"It would be nice to extend the syntax of the \f(CW\*(C`~~\*(C'\fR operator to alsounderstand numeric (and maybe alphanumeric) ranges..Sh "A \fIdoes()\fP built-in".IX Subsection "A does() built-in"Like \fIref()\fR, only useful. It would call the \f(CW\*(C`DOES\*(C'\fR method on objects; itwould also tell whether something can be dereferenced as anarray/hash/etc., or used as a regexp, etc.<http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/2007\-03/msg00481.html>.Sh "Tied filehandles and \fIwrite()\fP don't mix".IX Subsection "Tied filehandles and write() don't mix"There is no method on tied filehandles to allow them to be called back byformats..Sh "Attach/detach debugger from running program".IX Subsection "Attach/detach debugger from running program"The old perltodo notes "With \f(CW\*(C`gdb\*(C'\fR, you can attach the debugger to a runningprogram if you pass the process \s-1ID\s0. It would be good to do this with the Perldebugger on a running Perl program, although I'm not sure how it would bedone." ssh and screen do this with named pipes in /tmp. Maybe we can too..Sh "Optimize away empty destructors".IX Subsection "Optimize away empty destructors"Defining an empty \s-1DESTROY\s0 method might be useful (notably inAUTOLOAD-enabled classes), but it's still a bit expensive to call. Thatcould probably be optimized..Sh "\s-1LVALUE\s0 functions for lists".IX Subsection "LVALUE functions for lists"The old perltodo notes that lvalue functions don't work for list or hashslices. This would be good to fix..Sh "\s-1LVALUE\s0 functions in the debugger".IX Subsection "LVALUE functions in the debugger"The old perltodo notes that lvalue functions don't work in the debugger. Thiswould be good to fix..Sh "regexp optimiser optional".IX Subsection "regexp optimiser optional"The regexp optimiser is not optional. It should configurable to be, to allowits performance to be measured, and its bugs to be easily demonstrated..Sh "delete &function".IX Subsection "delete &function"Allow to delete functions. One can already undef them, but they're stillin the stash..ie n .Sh """/w"" regex modifier".el .Sh "\f(CW/w\fP regex modifier".IX Subsection "/w regex modifier"That flag would enable to match whole words, and also to interpolatearrays as alternations. With it, \f(CW\*(C`/P/w\*(C'\fR would be roughly equivalent to:.PP.Vb 1\& do { local $"=\*(Aq|\*(Aq; /\eb(?:P)\eb/ }.Ve.PPSee <http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/2007\-01/msg00400.html>for the discussion..Sh "optional optimizer".IX Subsection "optional optimizer"Make the peephole optimizer optional. Currently it performs two tasks asit walks the optree \- genuine peephole optimisations, and necessary fixups ofops. It would be good to find an efficient way to switch out theoptimisations whilst keeping the fixups..Sh "You \s-1WANT\s0 *how* many".IX Subsection "You WANT *how* many"Currently contexts are void, scalar and list. split has a special mechanism inplace to pass in the number of return values wanted. It would be useful tohave a general mechanism for this, backwards compatible and little speed hit.This would allow proposals such as short circuiting sort to be implementedas a module on \s-1CPAN\s0..Sh "lexical aliases".IX Subsection "lexical aliases"Allow lexical aliases (maybe via the syntax \f(CW\*(C`my \e$alias = \e$foo\*(C'\fR..Sh "entersub \s-1XS\s0 vs Perl".IX Subsection "entersub XS vs Perl"At the moment pp_entersub is huge, and has code to deal with entering bothperl and \s-1XS\s0 subroutines. Subroutine implementations rarely change between perl and \s-1XS\s0 at run time, so investigate using 2 ops to enter subs (one for\&\s-1XS\s0, one for perl) and swap between if a sub is redefined..Sh "Self-ties".IX Subsection "Self-ties"Self-ties are currently illegal because they caused too many segfaults. Maybethe causes of these could be tracked down and self-ties on all typesreinstated..ie n .Sh "Optimize away @_".el .Sh "Optimize away \f(CW@_\fP".IX Subsection "Optimize away @_"The old perltodo notes \*(L"Look at the \*(R"reification" code in \f(CW\*(C`av.c\*(C'\fR"..Sh "The yada yada yada operators".IX Subsection "The yada yada yada operators"Perl 6's Synopsis 3 says:.PP\&\fIThe ... operator is the \*(L"yada, yada, yada\*(R" list operator, which is used asthe body in function prototypes. It complains bitterly (by calling fail)if it is ever executed. Variant ??? calls warn, and !!! calls die.\fR.PPThose would be nice to add to Perl 5. That could be done without new ops..Sh "Virtualize operating system access".IX Subsection "Virtualize operating system access"Implement a set of \*(L"vtables\*(R" that virtualizes operating system access(\fIopen()\fR, \fImkdir()\fR, \fIunlink()\fR, \fIreaddir()\fR, \fIgetenv()\fR, etc.) At the veryleast these interfaces should take SVs as \*(L"name\*(R" arguments instead ofbare char pointers; probably the most flexible and extensible waywould be for the Perl-facing interfaces to accept HVs. The systemneeds to be per-operating-system and per-file-systemhookable/filterable, preferably both from \s-1XS\s0 and Perl level(\*(L"Files and Filesystems\*(R" in perlport is good reading at this point,in fact, all of perlport is.).PPThis has actually already been implemented (but only for Win32),take a look at \fIiperlsys.h\fR and \fIwin32/perlhost.h\fR. While all Win32variants go through a set of \*(L"vtables\*(R" for operating system access,non\-Win32 systems currently go straight for the POSIX/UNIX\-stylesystem/library call. Similar system as for Win32 should beimplemented for all platforms. The existing Win32 implementationprobably does not need to survive alongside this proposed newimplementation, the approaches could be merged..PPWhat would this give us? One often-asked-for feature this wouldenable is using Unicode for filenames, and other \*(L"names\*(R" like \f(CW%ENV\fR,usernames, hostnames, and so forth.(See \*(L"When Unicode Does Not Happen\*(R" in perlunicode.).PPBut this kind of virtualization would also allow for things likevirtual filesystems, virtual networks, and \*(L"sandboxes\*(R" (though as longas dynamic loading of random object code is allowed, not very safesandboxes since external code of course know not of Perl's vtables).An example of a smaller \*(L"sandbox\*(R" is that this feature can be used toimplement per-thread working directories: Win32 already does this..PPSee also \*(L"Extend PerlIO and PerlIO::Scalar\*(R"..Sh "Investigate \s-1PADTMP\s0 hash pessimisation".IX Subsection "Investigate PADTMP hash pessimisation"The peephole optimier converts constants used for hash key lookups to sharedhash key scalars. Under ithreads, something is undoing this work. SeeSee http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/2007\-09/msg00793.html.SH "Big projects".IX Header "Big projects"Tasks that will get your name mentioned in the description of the \*(L"Highlightsof 5.12\*(R".Sh "make ithreads more robust".IX Subsection "make ithreads more robust"Generally make ithreads more robust. See also \*(L"iCOW\*(R".PPThis task is incremental \- even a little bit of work on it will help, andwill be greatly appreciated..PPOne bit would be to write the missing code in sv.c:Perl_dirp_dup..PPFix Perl_sv_dup, et al so that threads can return objects..Sh "iCOW".IX Subsection "iCOW"Sarathy and Arthur have a proposal for an improved Copy On Write whichspecifically will be able to \s-1COW\s0 new ithreads. If this can be implementedit would be a good thing..Sh "(?{...}) closures in regexps".IX Subsection "(?{...}) closures in regexps"Fix (or rewrite) the implementation of the \f(CW\*(C`/(?{...})/\*(C'\fR closures..Sh "A re-entrant regexp engine".IX Subsection "A re-entrant regexp engine"This will allow the use of a regex from inside (?{ }), (??{ }) and(?(?{ })|) constructs..Sh "Add class set operations to regexp engine".IX Subsection "Add class set operations to regexp engine"Apparently these are quite useful. Anyway, Jeffery Friedl wants them..PPdemerphq has this on his todo list, but right at the bottom.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -