3 perltodo - Perl TO-DO List
7 This is a list of wishes for Perl. Send updates to
8 I<perl5-porters@perl.org>. If you want to work on any of these
9 projects, be sure to check the perl5-porters archives for past ideas,
10 flames, and propaganda. This will save you time and also prevent you
11 from implementing something that Larry has already vetoed. One set
12 of archives may be found at:
14 http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
18 Clean up and finish support for assertions. See L<assertions>.
22 Sarathy and Arthur have a proposal for an improved Copy On Write which
23 specifically will be able to COW new ithreads. If this can be implemented
24 it would be a good thing.
26 =head1 (?{...}) closures in regexps
28 Fix (or rewrite) the implementation of the C</(?{...})/> closures.
32 =head2 lexical pragmas
34 Reimplement the mechanism of lexical pragmas to be more extensible. Fix
35 current pragmas that don't work well (or at all) with lexical scopes or in
36 run-time eval(STRING) (C<sort>, C<re>, C<encoding> for example). MJD has a
37 preliminary patch that implements this.
39 =head2 use less 'memory'
41 Investigate trade offs to switch out perl's choices on memory usage.
42 Particularly perl should be able to give memory back.
44 =head1 prototypes and functions
46 =head2 _ prototype character
48 Study the possibility of adding a new prototype character, C<_>, meaning
49 "this argument defaults to $_".
51 =head2 inlining autoloaded constants
53 Currently the optimiser can inline constants when expressed as subroutines
54 with prototype ($) that return a constant. Likewise, many packages wrapping
55 C libraries export lots of constants as subroutines which are AUTOLOADed on
56 demand. However, these have no prototypes, so can't be seen as constants by
57 the optimiser. Some way of cheaply (low syntax, low memory overhead) to the
58 perl compiler that a name is a constant would be great, so that it knows to
59 call the AUTOLOAD routine at compile time, and then inline the constant.
61 =head2 Finish off lvalue functions
63 The old perltodo notes "They don't work in the debugger, and they don't work for
66 =head1 Unicode and UTF8
68 =head2 Implicit Latin 1 => Unicode translation
70 Conversions from byte strings to UTF-8 currently map high bit characters
71 to Unicode without translation (or, depending on how you look at it, by
72 implicitly assuming that the byte strings are in Latin-1). As perl assumes
73 the C locale by default, upgrading a string to UTF-8 may change the
74 meaning of its contents regarding character classes, case mapping, etc.
75 This should probably emit a warning (at least).
77 =head2 UTF8 caching code
79 The string position/offset cache is not optional. It should be.
81 =head2 Unicode in Filenames
83 chdir, chmod, chown, chroot, exec, glob, link, lstat, mkdir, open,
84 opendir, qx, readdir, readlink, rename, rmdir, stat, symlink, sysopen,
85 system, truncate, unlink, utime, -X. All these could potentially accept
86 Unicode filenames either as input or output (and in the case of system
87 and qx Unicode in general, as input or output to/from the shell).
88 Whether a filesystem - an operating system pair understands Unicode in
91 Known combinations that have some level of understanding include
92 Microsoft NTFS, Apple HFS+ (In Mac OS 9 and X) and Apple UFS (in Mac
93 OS X), NFS v4 is rumored to be Unicode, and of course Plan 9. How to
94 create Unicode filenames, what forms of Unicode are accepted and used
95 (UCS-2, UTF-16, UTF-8), what (if any) is the normalization form used,
96 and so on, varies. Finding the right level of interfacing to Perl
97 requires some thought. Remember that an OS does not implicate a
100 (The Windows -C command flag "wide API support" has been at least
101 temporarily retired in 5.8.1, and the -C has been repurposed, see
104 =head2 Unicode in %ENV
106 Currently the %ENV entries are always byte strings.
110 =head2 regexp optimiser optional
112 The regexp optimiser is not optional. It should configurable to be, to allow
113 its performance to be measured, and its bugs to be easily demonstrated.
115 =head2 common suffices/prefices in regexps (trie optimization)
117 Currently, the user has to optimize C<foo|far> and C<foo|goo> into
118 C<f(?:oo|ar)> and C<[fg]oo> by hand; this could be done automatically.
122 =head2 POD -> HTML conversion still sucks
124 Which is crazy given just how simple POD purports to be, and how simple HTML
127 =head1 Misc medium sized projects
131 Introduce a new special block, UNITCHECK, which is run at the end of a
132 compilation unit (module, file, eval(STRING) block). This will correspond to
133 the Perl 6 CHECK. Perl 5's CHECK cannot be changed or removed because the
134 O.pm/B.pm backend framework depends on it.
136 =head2 optional optimizer
138 Make the peephole optimizer optional.
140 =head2 You WANT *how* many
142 Currently contexts are void, scalar and list. split has a special mechanism in
143 place to pass in the number of return values wanted. It would be useful to
144 have a general mechanism for this, backwards compatible and little speed hit.
145 This would allow proposals such as short circuiting sort to be implemented
148 =head2 lexical aliases
150 Allow lexical aliases (maybe via the syntax C<my \$alias = \$foo>.
154 Make C<no 6> and C<no v6> work (opposite of C<use 5.005>, etc.).
158 Clean this up. Check everything in core works
160 =head2 entersub XS vs Perl
162 At the moment pp_entersub is huge, and has code to deal with entering both
163 perl and and XS subroutines. Subroutine implementations rarely change between
164 perl and XS at run time, so investigate using 2 ops to enter subs (one for
165 XS, one for perl) and swap between if a sub is redefined.
167 =head2 @INC source filter to Filter::Simple
169 The second return value from a sub in @INC can be a source filter. This isn't
170 documented. It should be changed to use Filter::Simple, tested and documented.
172 =head2 bincompat functions
174 There are lots of functions which are retained for binary compatibility.
175 Clean these up. Move them to mathom.c, and don't compile for blead?
177 =head2 Use fchown/fchmod internally
179 The old perltodo notes "This has been done in places, but needs a thorough
180 code review. Also fchdir is available in some platforms."
182 =head2 foreach reverse
184 The old perltodo notes that we could optimise foreach to iterate in reverse.
185 (instead of making a reversed copy on the stack)
186 It seems that cx->blk_loop.itermax could be hijacked to act as a go up/go
187 down flag, with cx->blk_loop.iterix primed in pp_enteriter for the go down
188 case (ie reverse). However, it looks slightly tricky identifying the shape of
189 foreach reverse in the optree in Perl_peep.
193 =head2 Make Schwern poorer
195 Tests for everything, At which point Schwern coughs up $500 to TPF.
199 A test suite for the B module would be nice.
201 =head2 Improve tests for Config.pm
203 Config.pm doesn't appear to be well tested.
205 =head2 common test code for timed bailout
207 Write portable self destruct code for tests to stop them burning CPU in
208 infinite loops. Needs to avoid using alarm, as some of the tests are testing
209 alarm/sleep or timers.
213 =head2 compressed man pages
215 Be able to install them
217 =head2 Make Config.pm cope with differences between build and installed perl
219 =head2 Relocatable perl
221 Make it possible to create a relocatable perl binary. Will need some collusion
222 with Config.pm. We could use a syntax of ... for location of current binary?
224 =head2 make HTML install work
226 =head2 put patchlevel in -v
228 Currently perl from p4/rsync ships with a patchlevel.h file that usually
229 defines one local patch, of the form "MAINT12345" or "RC1". The output of
230 perl -v doesn't report that a perl isn't an official release, and this
231 information can get lost in bugs reports. Because of this, the minor version
232 isn't bumped up util RC time, to minimise the possibility of versions of perl
233 escaping that believe themselves to be newer than they actually are.
235 It would be useful to find an elegant way to have the "this is an interim
236 maintenance release" or "this is a release candidate" in the terse -v output,
237 and have it so that it's easy for the pumpking to remove this just as the
238 release tarball is rolled up. This way the version pulled out of rsync would
239 always say "I'm a development release" and it would be safe to bump the
240 reported minor version as soon as a release ships, which would aid perl
243 =head1 Incremental things
245 Some tasks that don't need to get done in one big hit.
247 =head2 autovivification
249 Make all autovivification consistent w.r.t LVALUE/RVALUE and strict/no strict;
251 =head2 fix tainting bugs
253 Fix the bugs revealed by running the test suite with the C<-t> switch (via
254 C<make test.taintwarn>).
256 =head2 Make tainting consistent
258 Tainting would be easier to use if it didn't take documented shortcuts and allow
259 taint to "leak" everywhere within an expression.
261 =head2 Dual life everything
263 As part of the "dists" plan, anything that doesn't belong in the smallest perl
264 distribution needs to be dual lifed. Anything else can be too.
268 Some more nebulous ideas
272 Make threads more robust.
274 =head2 POSIX memory footprint
276 Ilya observed that use POSIX; eats memory like there's no tomorrow, and at
277 various times worked to cut it down. There is probably still fat to cut out -
278 for example POSIX passes Exporter some very memory hungry data structures.
280 =head2 Optimize away @_
282 The old perltodo notes "Look at the "reification" code in C<av.c>"
286 The old perltodo notes "Although we have C<Switch.pm> in core, Larry points to
287 the dormant C<nswitch> and C<cswitch> ops in F<pp.c>; using these opcodes would
290 =head2 Attach/detach debugger from running program
292 The old perltodo notes "With C<gdb>, you can attach the debugger to a running
293 program if you pass the process ID. It would be good to do this with the Perl
294 debugger on a running Perl program, although I'm not sure how it would be done."
295 ssh and screen do this with named pipes in tmp. Maybe we can too.
297 =head2 A decent benchmark
299 perlbench seems impervious to any recent changes made to the perl core. It would
300 be useful to have a reasonable general benchmarking suite that roughly
301 represented what current perl programs do, and measurably reported whether
302 tweaks to the core improve, degrade or don't really affect performance, to
303 guide people attempting to optimise the guts of perl.