1PERLTODO(1) Perl Programmers Reference Guide PERLTODO(1)
2
3
4
6 perltodo - Perl TO-DO List
7
9 This is a list of wishes for Perl. The tasks we think are smaller or
10 easier are listed first. Anyone is welcome to work on any of these, but
11 it's a good idea to first contact perl5-porters@perl.org to avoid
12 duplication of effort. By all means contact a pumpking privately first
13 if you prefer.
14
15 Whilst patches to make the list shorter are most welcome, ideas to add
16 to the list are also encouraged. Check the perl5-porters archives for
17 past ideas, and any discussion about them. One set of archives may be
18 found at:
19
20 http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
21
22 What can we offer you in return? Fame, fortune, and everlasting glory?
23 Maybe not, but if your patch is incorporated, then we'll add your name
24 to the AUTHORS file, which ships in the official distribution. How many
25 other programming languages offer you 1 line of immortality?
26
28 The roadmap to 5.10 envisages feature based releases, as various items
29 in this TODO are completed.
30
31 Needed for a 5.9.4 release
32
33 · Review assertions. Review syntax to combine assertions. Assertions
34 could take advantage of the lexical pragmas work. "What hooks would
35 assertions need?"
36
37 Needed for a 5.9.5 release
38
39 * Implement "_ prototype character"
40 * Implement "state variables"
41
42 Needed for a 5.9.6 release
43
44 Stabilisation. If all goes well, this will be the equivalent of a
45 5.10-beta.
46
48 common test code for timed bail out
49
50 Write portable self destruct code for tests to stop them burning CPU in
51 infinite loops. This needs to avoid using alarm, as some of the tests
52 are testing alarm/sleep or timers.
53
54 POD -> HTML conversion in the core still sucks
55
56 Which is crazy given just how simple POD purports to be, and how simple
57 HTML can be. It's not actually as simple as it sounds, particularly
58 with the flexibility POD allows for "=item", but it would be good to
59 improve the visual appeal of the HTML generated, and to avoid it having
60 any validation errors. See also "make HTML install work", as the layout
61 of installation tree is needed to improve the cross-linking.
62
63 The addition of "Pod::Simple" and its related modules may make this
64 task easier to complete.
65
66 Parallel testing
67
68 The core regression test suite is getting ever more comprehensive,
69 which has the side effect that it takes longer to run. This isn't so
70 good. Investigate whether it would be feasible to give the harness
71 script the option of running sets of tests in parallel. This would be
72 useful for tests in t/op/*.t and t/uni/*.t and maybe some sets of tests
73 in lib/.
74
75 Questions to answer
76
77 1 How does screen layout work when you're running more than one test?
78
79 2 How does the caller of test specify how many tests to run in paral‐
80 lel?
81
82 3 How do setup/teardown tests identify themselves?
83
84 Pugs already does parallel testing - can their approach be re-used?
85
86 Make Schwern poorer
87
88 We should have for everything. When all the core's modules are tested,
89 Schwern has promised to donate to $500 to TPF. We may need volunteers
90 to hold him upside down and shake vigorously in order to actually
91 extract the cash.
92
93 See t/lib/1_compile.t for the 3 remaining modules that need tests.
94
95 Improve the coverage of the core tests
96
97 Use Devel::Cover to ascertain the core's test coverage, then add tests
98 that are currently missing.
99
100 test B
101
102 A full test suite for the B module would be nice.
103
104 A decent benchmark
105
106 "perlbench" seems impervious to any recent changes made to the perl
107 core. It would be useful to have a reasonable general benchmarking
108 suite that roughly represented what current perl programs do, and mea‐
109 surably reported whether tweaks to the core improve, degrade or don't
110 really affect performance, to guide people attempting to optimise the
111 guts of perl. Gisle would welcome new tests for perlbench.
112
113 fix tainting bugs
114
115 Fix the bugs revealed by running the test suite with the "-t" switch
116 (via "make test.taintwarn").
117
118 Dual life everything
119
120 As part of the "dists" plan, anything that doesn't belong in the small‐
121 est perl distribution needs to be dual lifed. Anything else can be too.
122 Figure out what changes would be needed to package that module and its
123 tests up for CPAN, and do so. Test it with older perl releases, and fix
124 the problems you find.
125
126 Improving "threads::shared"
127
128 Investigate whether "threads::shared" could share aggregates properly
129 with only Perl level changes to shared.pm
130
131 POSIX memory footprint
132
133 Ilya observed that use POSIX; eats memory like there's no tomorrow, and
134 at various times worked to cut it down. There is probably still fat to
135 cut out - for example POSIX passes Exporter some very memory hungry
136 data structures.
137
139 Or if you prefer, tasks that you would learn from, and broaden your
140 skills base...
141
142 Relocatable perl
143
144 The C level patches needed to create a relocatable perl binary are
145 done, as is the work on Config.pm. All that's left to do is the "Con‐
146 figure" tweaking to let people specify how they want to do the install.
147
148 make HTML install work
149
150 There is an "installhtml" target in the Makefile. It's marked as
151 "experimental". It would be good to get this tested, make it work reli‐
152 ably, and remove the "experimental" tag. This would include
153
154 1 Checking that cross linking between various parts of the documenta‐
155 tion works. In particular that links work between the modules
156 (files with POD in lib/) and the core documentation (files in pod/)
157
158 2 Work out how to split "perlfunc" into chunks, preferably one per
159 function group, preferably with general case code that could be
160 used elsewhere. Challenges here are correctly identifying the
161 groups of functions that go together, and making the right named
162 external cross-links point to the right page. Things to be aware of
163 are "-X", groups such as "getpwnam" to "endservent", two or more
164 "=items" giving the different parameter lists, such as
165
166 =item substr EXPR,OFFSET,LENGTH,REPLACEMENT
167
168 =item substr EXPR,OFFSET,LENGTH
169
170 =item substr EXPR,OFFSET
171
172 and different parameter lists having different meanings. (eg
173 "select")
174
175 compressed man pages
176
177 Be able to install them. This would probably need a configure test to
178 see how the system does compressed man pages (same directory/different
179 directory? same filename/different filename), as well as tweaking the
180 installman script to compress as necessary.
181
182 Add a code coverage target to the Makefile
183
184 Make it easy for anyone to run Devel::Cover on the core's tests. The
185 steps to do this manually are roughly
186
187 · do a normal "Configure", but include Devel::Cover as a module to
188 install (see INSTALL for how to do this)
189
190 ·
191 make perl
192
193 ·
194 cd t; HARNESS_PERL_SWITCHES=-MDevel::Cover ./perl -I../lib harness
195
196 · Process the resulting Devel::Cover database
197
198 This just give you the coverage of the .pms. To also get the C level
199 coverage you need to
200
201 · Additionally tell "Configure" to use the appropriate C compiler
202 flags for "gcov"
203
204 ·
205 make perl.gcov
206
207 (instead of "make perl")
208
209 · After running the tests run "gcov" to generate all the .gcov files.
210 (Including down in the subdirectories of ext/
211
212 · (From the top level perl directory) run "gcov2perl" on all the
213 ".gcov" files to get their stats into the cover_db directory.
214
215 · Then process the Devel::Cover database
216
217 It would be good to add a single switch to "Configure" to specify that
218 you wanted to perform perl level coverage, and another to specify C
219 level coverage, and have "Configure" and the Makefile do all the right
220 things automatically.
221
222 Make Config.pm cope with differences between build and installed perl
223
224 Quite often vendors ship a perl binary compiled with their (pay-for)
225 compilers. People install a free compiler, such as gcc. To work out
226 how to build extensions, Perl interrogates %Config, so in this situa‐
227 tion %Config describes compilers that aren't there, and extension
228 building fails. This forces people into choosing between re-compiling
229 perl themselves using the compiler they have, or only using modules
230 that the vendor ships.
231
232 It would be good to find a way teach "Config.pm" about the installation
233 setup, possibly involving probing at install time or later, so that the
234 %Config in a binary distribution better describes the installed
235 machine, when the installed machine differs from the build machine in
236 some significant way.
237
238 make parallel builds work
239
240 Currently parallel builds (such as "make -j3") don't work reliably. We
241 believe that this is due to incomplete dependency specification in the
242 Makefile. It would be good if someone were able to track down the
243 causes of these problems, so that parallel builds worked properly.
244
245 linker specification files
246
247 Some platforms mandate that you provide a list of a shared library's
248 external symbols to the linker, so the core already has the infrastruc‐
249 ture in place to do this for generating shared perl libraries. My
250 understanding is that the GNU toolchain can accept an optional linker
251 specification file, and restrict visibility just to symbols declared in
252 that file. It would be good to extend makedef.pl to support this for‐
253 mat, and to provide a means within "Configure" to enable it. This would
254 allow Unix users to test that the export list is correct, and to build
255 a perl that does not pollute the global namespace with private symbols.
256
258 These tasks would need a little C knowledge, but don't need any spe‐
259 cific background or experience with XS, or how the Perl interpreter
260 works
261
262 Make it clear from -v if this is the exact official release
263
264 Currently perl from "p4"/"rsync" ships with a patchlevel.h file that
265 usually defines one local patch, of the form "MAINT12345" or "RC1". The
266 output of perl -v doesn't report that a perl isn't an official release,
267 and this information can get lost in bugs reports. Because of this, the
268 minor version isn't bumped up until RC time, to minimise the possibil‐
269 ity of versions of perl escaping that believe themselves to be newer
270 than they actually are.
271
272 It would be useful to find an elegant way to have the "this is an
273 interim maintenance release" or "this is a release candidate" in the
274 terse -v output, and have it so that it's easy for the pumpking to
275 remove this just as the release tarball is rolled up. This way the ver‐
276 sion pulled out of rsync would always say "I'm a development release"
277 and it would be safe to bump the reported minor version as soon as a
278 release ships, which would aid perl developers.
279
280 This task is really about thinking of an elegant way to arrange the C
281 source such that it's trivial for the Pumpking to flag "this is an
282 official release" when making a tarball, yet leave the default source
283 saying "I'm not the official release".
284
285 Tidy up global variables
286
287 There's a note in intrpvar.h
288
289 /* These two variables are needed to preserve 5.8.x bincompat because
290 we can't change function prototypes of two exported functions.
291 Probably should be taken out of blead soon, and relevant prototypes
292 changed. */
293
294 So doing this, and removing any of the unused variables still present
295 would be good.
296
297 Ordering of "global" variables.
298
299 thrdvar.h and intrpvarh define the "global" variables that need to be
300 per-thread under ithreads, where the variables are actually elements in
301 a structure. As C dictates, the variables must be laid out in order of
302 declaration. There is a comment "/* Important ones in the first cache
303 line (if alignment is done right) */" which implies that at some point
304 in the past the ordering was carefully chosen (at least in part). How‐
305 ever, it's clear that the ordering is less than perfect, as currently
306 there are things such as 7 "bool"s in a row, then something typically
307 requiring 4 byte alignment, and then an odd "bool" later on. ("bool"s
308 are typically defined as "char"s). So it would be good for someone to
309 review the ordering of the variables, to see how much alignment padding
310 can be removed.
311
312 bincompat functions
313
314 There are lots of functions which are retained for binary compatibil‐
315 ity. Clean these up. Move them to mathom.c, and don't compile for
316 blead?
317
318 am I hot or not?
319
320 The idea of pp_hot.c is that it contains the hot ops, the ops that are
321 most commonly used. The idea is that by grouping them, their object
322 code will be adjacent in the executable, so they have a greater chance
323 of already being in the CPU cache (or swapped in) due to being near
324 another op already in use.
325
326 Except that it's not clear if these really are the most commonly used
327 ops. So anyone feeling like exercising their skill with coverage and
328 profiling tools might want to determine what ops really are the most
329 commonly used. And in turn suggest evictions and promotions to achieve
330 a better pp_hot.c.
331
332 emulate the per-thread memory pool on Unix
333
334 For Windows, ithreads allocates memory for each thread from a separate
335 pool, which it discards at thread exit. It also checks that memory is
336 free()d to the correct pool. Neither check is done on Unix, so code
337 developed there won't be subject to such strictures, so can harbour
338 bugs that only show up when the code reaches Windows.
339
340 It would be good to be able to optionally emulate the Window pool sys‐
341 tem on Unix, to let developers who only have access to Unix, or want to
342 use Unix-specific debugging tools, check for these problems. To do this
343 would involve figuring out how the "PerlMem_*" macros wrap "malloc()"
344 access, and providing a layer that records/checks the identity of the
345 thread making the call, and recording all the memory allocated by each
346 thread via this API so that it can be summarily free()d at thread exit.
347 One implementation idea would be to increase the size of allocation,
348 and store the "my_perl" pointer (to identify the thread) at the start,
349 along with pointers to make a linked list of blocks for this thread. To
350 avoid alignment problems it would be necessary to do something like
351
352 union memory_header_padded {
353 struct memory_header {
354 void *thread_id; /* For my_perl */
355 void *next; /* Pointer to next block for this thread */
356 } data;
357 long double padding; /* whatever type has maximal alignment constraint */
358 };
359
360 although "long double" might not be the only type to add to the padding
361 union.
362
363 reduce duplication in sv_setsv_flags
364
365 "Perl_sv_setsv_flags" has a comment "/* There's a lot of redundancy
366 below but we're going for speed here */"
367
368 Whilst this was true 10 years ago, the growing disparity between RAM
369 and CPU speeds mean that the trade offs have changed. In addition, the
370 duplicate code adds to the maintenance burden. It would be good to see
371 how much of the redundancy can be pruned, particular in the less common
372 paths. (Profiling tools at the ready...). For example, why does the
373 test for "Can't redefine active sort subroutine" need to occur in two
374 places?
375
377 These tasks would need C knowledge, and roughly the level of knowledge
378 of the perl API that comes from writing modules that use XS to inter‐
379 face to C.
380
381 IPv6
382
383 Clean this up. Check everything in core works
384
385 shrink "GV"s, "CV"s
386
387 By removing unused elements and careful re-ordering, the structures for
388 "AV"s and "HV"s have recently been shrunk considerably. It's probable
389 that the same approach would find savings in "GV"s and "CV"s, if not
390 all the other larger-than-"PVMG" types.
391
392 merge Perl_sv_2[inpu]v
393
394 There's a lot of code shared between "Perl_sv_2iv_flags",
395 "Perl_sv_2uv_flags", "Perl_sv_2nv", and "Perl_sv_2pv_flags". It would
396 be interesting to see if some of it can be merged into common shared
397 static functions. In particular, "Perl_sv_2uv_flags" started out as a
398 cut&paste from "Perl_sv_2iv_flags" around 5.005_50 time, and it may be
399 possible to replace both with a single function that returns a value or
400 union which is split out by the macros in sv.h
401
402 UTF8 caching code
403
404 The string position/offset cache is not optional. It should be.
405
406 Implicit Latin 1 => Unicode translation
407
408 Conversions from byte strings to UTF-8 currently map high bit charac‐
409 ters to Unicode without translation (or, depending on how you look at
410 it, by implicitly assuming that the byte strings are in Latin-1). As
411 perl assumes the C locale by default, upgrading a string to UTF-8 may
412 change the meaning of its contents regarding character classes, case
413 mapping, etc. This should probably emit a warning (at least).
414
415 This task is incremental - even a little bit of work on it will help.
416
417 autovivification
418
419 Make all autovivification consistent w.r.t LVALUE/RVALUE and strict/no
420 strict;
421
422 This task is incremental - even a little bit of work on it will help.
423
424 Unicode in Filenames
425
426 chdir, chmod, chown, chroot, exec, glob, link, lstat, mkdir, open,
427 opendir, qx, readdir, readlink, rename, rmdir, stat, symlink, sysopen,
428 system, truncate, unlink, utime, -X. All these could potentially
429 accept Unicode filenames either as input or output (and in the case of
430 system and qx Unicode in general, as input or output to/from the
431 shell). Whether a filesystem - an operating system pair understands
432 Unicode in filenames varies.
433
434 Known combinations that have some level of understanding include Micro‐
435 soft NTFS, Apple HFS+ (In Mac OS 9 and X) and Apple UFS (in Mac OS X),
436 NFS v4 is rumored to be Unicode, and of course Plan 9. How to create
437 Unicode filenames, what forms of Unicode are accepted and used (UCS-2,
438 UTF-16, UTF-8), what (if any) is the normalization form used, and so
439 on, varies. Finding the right level of interfacing to Perl requires
440 some thought. Remember that an OS does not implicate a filesystem.
441
442 (The Windows -C command flag "wide API support" has been at least tem‐
443 porarily retired in 5.8.1, and the -C has been repurposed, see perl‐
444 run.)
445
446 Unicode in %ENV
447
448 Currently the %ENV entries are always byte strings.
449
450 use less 'memory'
451
452 Investigate trade offs to switch out perl's choices on memory usage.
453 Particularly perl should be able to give memory back.
454
455 This task is incremental - even a little bit of work on it will help.
456
457 Re-implement ":unique" in a way that is actually thread-safe
458
459 The old implementation made bad assumptions on several levels. A good
460 90% solution might be just to make ":unique" work to share the string
461 buffer of SvPVs. That way large constant strings can be shared between
462 ithreads, such as the configuration information in Config.
463
464 Make tainting consistent
465
466 Tainting would be easier to use if it didn't take documented shortcuts
467 and allow taint to "leak" everywhere within an expression.
468
469 readpipe(LIST)
470
471 system() accepts a LIST syntax (and a PROGRAM LIST syntax) to avoid
472 running a shell. readpipe() (the function behind qx//) could be simi‐
473 larly extended.
474
476 These tasks would need C knowledge, and knowledge of how the inter‐
477 preter works, or a willingness to learn.
478
479 lexical pragmas
480
481 Document the new support for lexical pragmas in 5.9.3 and how %^H
482 works. Maybe "re", "encoding", maybe other pragmas could be made lexi‐
483 cal.
484
485 Attach/detach debugger from running program
486
487 The old perltodo notes "With "gdb", you can attach the debugger to a
488 running program if you pass the process ID. It would be good to do this
489 with the Perl debugger on a running Perl program, although I'm not sure
490 how it would be done." ssh and screen do this with named pipes in /tmp.
491 Maybe we can too.
492
493 Constant folding
494
495 The peephole optimiser should trap errors during constant folding, and
496 give up on the folding, rather than bailing out at compile time. It is
497 quite possible that the unfoldable constant is in unreachable code, eg
498 something akin to "$a = 0/0 if 0;"
499
500 LVALUE functions for lists
501
502 The old perltodo notes that lvalue functions don't work for list or
503 hash slices. This would be good to fix.
504
505 LVALUE functions in the debugger
506
507 The old perltodo notes that lvalue functions don't work in the debug‐
508 ger. This would be good to fix.
509
510 _ prototype character
511
512 Study the possibility of adding a new prototype character, "_", meaning
513 "this argument defaults to $_".
514
515 state variables
516
517 "my $foo if 0;" is deprecated, and should be replaced with "state $x =
518 "initial value\n";" the syntax from Perl 6.
519
520 @INC source filter to Filter::Simple
521
522 The second return value from a sub in @INC can be a source filter. This
523 isn't documented. It should be changed to use Filter::Simple, tested
524 and documented.
525
526 regexp optimiser optional
527
528 The regexp optimiser is not optional. It should configurable to be, to
529 allow its performance to be measured, and its bugs to be easily demon‐
530 strated.
531
532 UNITCHECK
533
534 Introduce a new special block, UNITCHECK, which is run at the end of a
535 compilation unit (module, file, eval(STRING) block). This will corre‐
536 spond to the Perl 6 CHECK. Perl 5's CHECK cannot be changed or removed
537 because the O.pm/B.pm backend framework depends on it.
538
539 optional optimizer
540
541 Make the peephole optimizer optional. Currently it performs two tasks
542 as it walks the optree - genuine peephole optimisations, and necessary
543 fixups of ops. It would be good to find an efficient way to switch out
544 the optimisations whilst keeping the fixups.
545
546 You WANT *how* many
547
548 Currently contexts are void, scalar and list. split has a special mech‐
549 anism in place to pass in the number of return values wanted. It would
550 be useful to have a general mechanism for this, backwards compatible
551 and little speed hit. This would allow proposals such as short cir‐
552 cuiting sort to be implemented as a module on CPAN.
553
554 lexical aliases
555
556 Allow lexical aliases (maybe via the syntax "my \$alias = \$foo".
557
558 entersub XS vs Perl
559
560 At the moment pp_entersub is huge, and has code to deal with entering
561 both perl and XS subroutines. Subroutine implementations rarely change
562 between perl and XS at run time, so investigate using 2 ops to enter
563 subs (one for XS, one for perl) and swap between if a sub is redefined.
564
565 Self ties
566
567 self ties are currently illegal because they caused too many segfaults.
568 Maybe the causes of these could be tracked down and self-ties on all
569 types re- instated.
570
571 Optimize away @_
572
573 The old perltodo notes "Look at the "reification" code in "av.c"".
574
575 What hooks would assertions need?
576
577 Assertions are in the core, and work. However, assertions needed to be
578 added as a core patch, rather than an XS module in ext, or a CPAN mod‐
579 ule, because the core has no hooks in the necessary places. It would be
580 useful to investigate what hooks would need to be added to make it pos‐
581 sible to provide the full assertion support from a CPAN module, so that
582 we aren't constraining the imagination of future CPAN authors.
583
585 Tasks that will get your name mentioned in the description of the
586 "Highlights of 5.10"
587
588 make ithreads more robust
589
590 Generally make ithreads more robust. See also "iCOW"
591
592 This task is incremental - even a little bit of work on it will help,
593 and will be greatly appreciated.
594
595 iCOW
596
597 Sarathy and Arthur have a proposal for an improved Copy On Write which
598 specifically will be able to COW new ithreads. If this can be imple‐
599 mented it would be a good thing.
600
601 (?{...}) closures in regexps
602
603 Fix (or rewrite) the implementation of the "/(?{...})/" closures.
604
605 A re-entrant regexp engine
606
607 This will allow the use of a regex from inside (?{ }), (??{ }) and
608 (?(?{ })⎪) constructs.
609
610
611
612perl v5.8.8 2006-01-07 PERLTODO(1)