This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: fchmod, fchown, fchdir
[perl5.git] / pod / perltodo.pod
CommitLineData
7711098a
GS
1=head1 NAME
2
3perltodo - Perl TO-DO List
4
5=head1 DESCRIPTION
e50bb9a1 6
722d2a37 7This is a list of wishes for Perl. Send updates to
e50bb9a1
GS
8I<perl5-porters@perl.org>. If you want to work on any of these
9projects, be sure to check the perl5-porters archives for past ideas,
10flames, and propaganda. This will save you time and also prevent you
11from implementing something that Larry has already vetoed. One set
12of archives may be found at:
13
14 http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
15
cd793d32 16=head1 assertions
e50bb9a1 17
cd793d32 18Clean up and finish support for assertions. See L<assertions>.
e50bb9a1 19
cd793d32 20=head1 iCOW
e50bb9a1 21
cd793d32
NC
22Sarathy and Arthur have a proposal for an improved Copy On Write which
23specifically will be able to COW new ithreads. If this can be implemented
24it would be a good thing.
e50bb9a1 25
cd793d32 26=head1 (?{...}) closures in regexps
4b3b956a 27
cd793d32 28Fix (or rewrite) the implementation of the C</(?{...})/> closures.
4b3b956a 29
cee7ab84
NC
30=head1 A re-entrant regexp engine
31
32This will allow the use of a regex from inside (?{ }), (??{ }) and
33(?(?{ })|) constructs.
34
cd793d32 35=head1 pragmata
e50bb9a1 36
cd793d32 37=head2 lexical pragmas
0562c0e3 38
cd793d32
NC
39Reimplement the mechanism of lexical pragmas to be more extensible. Fix
40current pragmas that don't work well (or at all) with lexical scopes or in
41run-time eval(STRING) (C<sort>, C<re>, C<encoding> for example). MJD has a
42preliminary patch that implements this.
0562c0e3 43
cd793d32 44=head2 use less 'memory'
f35392ae 45
cd793d32
NC
46Investigate trade offs to switch out perl's choices on memory usage.
47Particularly perl should be able to give memory back.
f35392ae 48
cd793d32 49=head1 prototypes and functions
c5fc23ff 50
cd793d32 51=head2 _ prototype character
e50bb9a1 52
cd793d32
NC
53Study the possibility of adding a new prototype character, C<_>, meaning
54"this argument defaults to $_".
e50bb9a1 55
cd793d32 56=head2 inlining autoloaded constants
776f8809 57
cd793d32
NC
58Currently the optimiser can inline constants when expressed as subroutines
59with prototype ($) that return a constant. Likewise, many packages wrapping
60C libraries export lots of constants as subroutines which are AUTOLOADed on
61demand. However, these have no prototypes, so can't be seen as constants by
62the optimiser. Some way of cheaply (low syntax, low memory overhead) to the
63perl compiler that a name is a constant would be great, so that it knows to
64call the AUTOLOAD routine at compile time, and then inline the constant.
776f8809 65
cd793d32 66=head2 Finish off lvalue functions
e50bb9a1 67
cd793d32
NC
68The old perltodo notes "They don't work in the debugger, and they don't work for
69list or hash slices."
e50bb9a1 70
cd793d32 71=head1 Unicode and UTF8
e50bb9a1 72
cd793d32 73=head2 Implicit Latin 1 => Unicode translation
e50bb9a1 74
cd793d32
NC
75Conversions from byte strings to UTF-8 currently map high bit characters
76to Unicode without translation (or, depending on how you look at it, by
77implicitly assuming that the byte strings are in Latin-1). As perl assumes
78the C locale by default, upgrading a string to UTF-8 may change the
79meaning of its contents regarding character classes, case mapping, etc.
80This should probably emit a warning (at least).
e50bb9a1 81
cd793d32 82=head2 UTF8 caching code
e50bb9a1 83
cd793d32 84The string position/offset cache is not optional. It should be.
e50bb9a1 85
938c8732
NC
86=head2 Unicode in Filenames
87
88chdir, chmod, chown, chroot, exec, glob, link, lstat, mkdir, open,
89opendir, qx, readdir, readlink, rename, rmdir, stat, symlink, sysopen,
90system, truncate, unlink, utime, -X. All these could potentially accept
91Unicode filenames either as input or output (and in the case of system
92and qx Unicode in general, as input or output to/from the shell).
93Whether a filesystem - an operating system pair understands Unicode in
94filenames varies.
95
96Known combinations that have some level of understanding include
97Microsoft NTFS, Apple HFS+ (In Mac OS 9 and X) and Apple UFS (in Mac
98OS X), NFS v4 is rumored to be Unicode, and of course Plan 9. How to
99create Unicode filenames, what forms of Unicode are accepted and used
100(UCS-2, UTF-16, UTF-8), what (if any) is the normalization form used,
101and so on, varies. Finding the right level of interfacing to Perl
102requires some thought. Remember that an OS does not implicate a
103filesystem.
104
105(The Windows -C command flag "wide API support" has been at least
106temporarily retired in 5.8.1, and the -C has been repurposed, see
107L<perlrun>.)
108
109=head2 Unicode in %ENV
110
111Currently the %ENV entries are always byte strings.
112
cd793d32 113=head1 Regexps
e50bb9a1 114
cd793d32 115=head2 regexp optimiser optional
e50bb9a1 116
cd793d32
NC
117The regexp optimiser is not optional. It should configurable to be, to allow
118its performance to be measured, and its bugs to be easily demonstrated.
e50bb9a1 119
cd793d32 120=head1 POD
e50bb9a1 121
cd793d32 122=head2 POD -> HTML conversion still sucks
e50bb9a1 123
938c8732 124Which is crazy given just how simple POD purports to be, and how simple HTML
adebf063
NC
125can be. It's not actually I<as> simple as it sounds, particularly with the
126flexibility POD allows for C<=item>, but it would be good to improve the
127visual appeal of the HTML generated, and to avoid it having any validation
128errors. See also L</make HTML install work>, as the layout of installation tree
129is needed to improve the cross-linking.
938c8732 130
cd793d32 131=head1 Misc medium sized projects
e50bb9a1 132
cd793d32 133=head2 UNITCHECK
e50bb9a1 134
cd793d32
NC
135Introduce a new special block, UNITCHECK, which is run at the end of a
136compilation unit (module, file, eval(STRING) block). This will correspond to
137the Perl 6 CHECK. Perl 5's CHECK cannot be changed or removed because the
138O.pm/B.pm backend framework depends on it.
e50bb9a1 139
cd793d32 140=head2 optional optimizer
e50bb9a1 141
cd793d32 142Make the peephole optimizer optional.
e50bb9a1 143
0c13e809
NC
144=head2 You WANT *how* many
145
60cb11a8 146Currently contexts are void, scalar and list. split has a special mechanism in
0c13e809
NC
147place to pass in the number of return values wanted. It would be useful to
148have a general mechanism for this, backwards compatible and little speed hit.
149This would allow proposals such as short circuiting sort to be implemented
150as a module on CPAN.
151
cd793d32 152=head2 lexical aliases
e50bb9a1 153
cd793d32 154Allow lexical aliases (maybe via the syntax C<my \$alias = \$foo>.
e50bb9a1 155
cd793d32 156=head2 no 6
e50bb9a1 157
cd793d32 158Make C<no 6> and C<no v6> work (opposite of C<use 5.005>, etc.).
e50bb9a1 159
cd793d32 160=head2 IPv6
3958b146 161
cd793d32 162Clean this up. Check everything in core works
e50bb9a1 163
cd793d32 164=head2 entersub XS vs Perl
e50bb9a1 165
cd793d32
NC
166At the moment pp_entersub is huge, and has code to deal with entering both
167perl and and XS subroutines. Subroutine implementations rarely change between
168perl and XS at run time, so investigate using 2 ops to enter subs (one for
169XS, one for perl) and swap between if a sub is redefined.
e50bb9a1 170
cd793d32 171=head2 @INC source filter to Filter::Simple
e50bb9a1 172
cd793d32
NC
173The second return value from a sub in @INC can be a source filter. This isn't
174documented. It should be changed to use Filter::Simple, tested and documented.
e50bb9a1 175
cd793d32 176=head2 bincompat functions
e50bb9a1 177
cd793d32
NC
178There are lots of functions which are retained for binary compatibility.
179Clean these up. Move them to mathom.c, and don't compile for blead?
e50bb9a1 180
6168cf99
NC
181=head2 Constant folding
182
183The peephole optimiser should trap errors during constant folding, and give
184up on the folding, rather than bailing out at compile time. It is quite
185possible that the unfoldable constant is in unreachable code, eg something
186akin to C<$a = 0/0 if 0;>
187
cd793d32 188=head1 Tests
e50bb9a1 189
cd793d32 190=head2 Make Schwern poorer
e50bb9a1 191
cd793d32 192Tests for everything, At which point Schwern coughs up $500 to TPF.
e50bb9a1 193
cd793d32 194=head2 test B
722d2a37 195
cd793d32 196A test suite for the B module would be nice.
722d2a37 197
cd793d32 198=head2 common test code for timed bailout
e50bb9a1 199
cd793d32
NC
200Write portable self destruct code for tests to stop them burning CPU in
201infinite loops. Needs to avoid using alarm, as some of the tests are testing
202alarm/sleep or timers.
e50bb9a1 203
cd793d32 204=head1 Installation
e50bb9a1 205
cd793d32 206=head2 compressed man pages
e50bb9a1 207
adebf063
NC
208Be able to install them. This would probably need a configure test to see how
209the system does compressed man pages (same directory/different directory?
210same filename/different filename), as well as tweaking the F<installman> script
211to compress as necessary.
e50bb9a1 212
cd793d32 213=head2 Make Config.pm cope with differences between build and installed perl
e50bb9a1 214
adebf063
NC
215Quite often vendors ship a perl binary compiled with their (pay-for)
216compilers. People install a free compiler, such as gcc. To work out how to
217build extensions, Perl interrogates C<%Config>, so in this situation
218C<%Config> describes compilers that aren't there, and extension building
219fails. This forces people into chosing between re-compiling perl themselves
220using the compiler they have, or only using modules that the vendor ships.
221
222It would be good to find a way teach C<Config.pm> about the installation setup,
223possibly involving probing at install time or later, so that the C<%Config> in
224a binary distruction better describes the installed machine, when the installed
225machine differs from the build machine in some significant way.
226
cd793d32 227=head2 Relocatable perl
e50bb9a1 228
cd793d32
NC
229Make it possible to create a relocatable perl binary. Will need some collusion
230with Config.pm. We could use a syntax of ... for location of current binary?
e50bb9a1 231
cd793d32 232=head2 make HTML install work
e50bb9a1 233
adebf063
NC
234There is an C<installhtml> target in the Makefile. It's marked as
235"experimental". It would be good to get this tested, make it work reliably, and
236remove the "experimental" tag. This would include
237
238=over 4
239
240=item 1
241
242Checking that cross linking between various parts of the documentation works.
243In particular that links work between the modules (files with POD in F<lib/>)
244and the core documentation (files in F<pod/>)
245
246=item 2
247
248Work out how to split perlfunc into chunks, preferably one per function group,
249preferably with general case code that could be used elsewhere. Challenges
250here are correctly identifying the groups of functions that go together, and
251making the right named external cross-links point to the right page. Things to
252be aware of are C<-X>, groups such as C<getpwnam> to C<endservent>, two or
253more C<=items> giving the different parameter lists, such as
254
255 =item substr EXPR,OFFSET,LENGTH,REPLACEMENT
256
257 =item substr EXPR,OFFSET,LENGTH
258
259 =item substr EXPR,OFFSET
260
261and different parameter lists having different meanings. (eg C<select>)
262
263=back
3a89a73c 264
89007cb3
NC
265=head2 put patchlevel in -v
266
267Currently perl from p4/rsync ships with a patchlevel.h file that usually
268defines one local patch, of the form "MAINT12345" or "RC1". The output of
269perl -v doesn't report that a perl isn't an official release, and this
270information can get lost in bugs reports. Because of this, the minor version
fa11829f 271isn't bumped up until RC time, to minimise the possibility of versions of perl
89007cb3
NC
272escaping that believe themselves to be newer than they actually are.
273
274It would be useful to find an elegant way to have the "this is an interim
275maintenance release" or "this is a release candidate" in the terse -v output,
276and have it so that it's easy for the pumpking to remove this just as the
277release tarball is rolled up. This way the version pulled out of rsync would
278always say "I'm a development release" and it would be safe to bump the
279reported minor version as soon as a release ships, which would aid perl
280developers.
281
cd793d32 282=head1 Incremental things
e50bb9a1 283
cd793d32 284Some tasks that don't need to get done in one big hit.
e50bb9a1 285
cd793d32 286=head2 autovivification
e50bb9a1 287
cd793d32 288Make all autovivification consistent w.r.t LVALUE/RVALUE and strict/no strict;
e50bb9a1 289
cd793d32 290=head2 fix tainting bugs
e50bb9a1 291
cd793d32
NC
292Fix the bugs revealed by running the test suite with the C<-t> switch (via
293C<make test.taintwarn>).
e50bb9a1 294
cd793d32 295=head2 Make tainting consistent
e50bb9a1 296
cd793d32
NC
297Tainting would be easier to use if it didn't take documented shortcuts and allow
298taint to "leak" everywhere within an expression.
e50bb9a1 299
969e704b
NC
300=head2 Dual life everything
301
302As part of the "dists" plan, anything that doesn't belong in the smallest perl
303distribution needs to be dual lifed. Anything else can be too.
304
cd793d32 305=head1 Vague things
e50bb9a1 306
cd793d32 307Some more nebulous ideas
e50bb9a1 308
cd793d32 309=head2 threads
e50bb9a1 310
0abe3f7c
NC
311=over 4
312
313=item *
314
315Re-implement C<:unique> in a way that is actualy thread-safe
316
317=item *
318
319Make C<threads::shared> share aggregates properly
320
321(these two may actually share approach, if not implementation
322
323=back
324
325Generally make threads more robust. See also L<iCOW>
e50bb9a1 326
cd793d32 327=head2 POSIX memory footprint
e50bb9a1 328
cd793d32
NC
329Ilya observed that use POSIX; eats memory like there's no tomorrow, and at
330various times worked to cut it down. There is probably still fat to cut out -
331for example POSIX passes Exporter some very memory hungry data structures.
e50bb9a1 332
cd793d32 333=head2 Optimize away @_
f86a8bc5 334
80b46460 335The old perltodo notes "Look at the "reification" code in C<av.c>".
3298bd4d 336
cd793d32 337=head2 switch ops
3298bd4d 338
cd793d32
NC
339The old perltodo notes "Although we have C<Switch.pm> in core, Larry points to
340the dormant C<nswitch> and C<cswitch> ops in F<pp.c>; using these opcodes would
341be much faster."
0562c0e3 342
d10fc472 343=head2 Attach/detach debugger from running program
1626a787 344
cd793d32
NC
345The old perltodo notes "With C<gdb>, you can attach the debugger to a running
346program if you pass the process ID. It would be good to do this with the Perl
347debugger on a running Perl program, although I'm not sure how it would be done."
348ssh and screen do this with named pipes in tmp. Maybe we can too.
1626a787 349
d10fc472
NC
350=head2 A decent benchmark
351
352perlbench seems impervious to any recent changes made to the perl core. It would
353be useful to have a reasonable general benchmarking suite that roughly
354represented what current perl programs do, and measurably reported whether
355tweaks to the core improve, degrade or don't really affect performance, to
356guide people attempting to optimise the guts of perl.
80b46460
RGS
357
358=head2 readpipe(LIST)
359
360system() accepts a LIST syntax (and a PROGRAM LIST syntax) to avoid
361running a shell. readpipe() (the function behind qx//) could be similarly
362extended.
2810d901
NC
363
364=head2 Self ties
365
366self ties are currently illegal because they caused too many segfaults. Maybe
367the causes of these could be tracked down and self-ties on all types re-
368instated.