Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 448 lines (301 sloc) 12.351 kb
8f67bea @fglock Perlito version 8.0
authored
1 TODO list for Perlito5
2
d6cad9b @fglock Perlito5 - TODO update
authored
3
25b8875 @fglock Perlito5 - TODO update
authored
4 * perlito5 command-line
e4641d7 @fglock Perlito - extensive TODO update
authored
5
6
8f67bea @fglock Perlito version 8.0
authored
7 * libraries
8
3004b77 @fglock Perlito5 - cleanup, update TODO
authored
9 -- these should probably go into namespace Perlito5X::*
10
ce7ce91 @fglock Perlito - TODO update
authored
11 -- Test (implemented as Perlito5::Test)
3004b77 @fglock Perlito5 - cleanup, update TODO
authored
12
ce7ce91 @fglock Perlito - TODO update
authored
13 -- Data::Dumper (implemented as Perlito5::Dumper)
8f67bea @fglock Perlito version 8.0
authored
14
24c23f7 @fglock Perlito5 - TODO update
authored
15 -- create perlito5-specific libs for:
7aeb314 @fglock Perlito5 - TODO update
authored
16 feature.pm
17 Config.pm
18 overload.pm
19 bytes.pm
20 integer.pm
21 constant.pm
22 lib.pm
23 Carp.pm
24 vars.pm
25 Tie::Array
26 Tie::Hash
27 Tie::Scalar
24c23f7 @fglock Perlito5 - TODO update
authored
28
4d56b5d @fglock Perlito5 - add $ENV{PERL5LIB} to @INC
authored
29 alternately, check $^H for strictness - such that perl's own strict.pm just works
30 and ${^WARNING_BITS} for warnings
31
8f67bea @fglock Perlito version 8.0
authored
32
7b982c3 @fglock Perlito5 - update TODO
authored
33 * Parser
34
2537119 @fglock Perlito5 - TODO update
authored
35 -- "'" meaning "::"
36 $'m # $::m
37 $m' # String found where operator expected
38
39 package X'Y # X::Y
40 package X' # Invalid version format (non-numeric data)
41
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
42 -- attributes
43 http://perldoc.perl.org/attributes.html
c2716c0 @fglock Perlito5 - parser - subroutine attributes
authored
44 missing MODIFY_CODE_ATTRIBUTES handlers
02db591 @fglock Perlito5 - update TODO
authored
45
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
46 -- create __DATA__
5058d24 @fglock Perlito5 - grammar - save __DATA__ sections
authored
47 %Perlito5::DATA_SECTION contains the __DATA__ for each package
48
ae33743 @fglock Perlito5 - TODO update
authored
49 -- compile-time eval() is not bound to the "program" environment, but to the "compiler" environment instead
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
50 see README-perlito5-js near "Compile-time / Run-time interleaving"
51
52 my $v;
53 BEGIN { $v = "123" }
54 use Module $v; # $v is not accessible at compile-time
7b982c3 @fglock Perlito5 - update TODO
authored
55
529225f @fglock Perlito5 - TODO update
authored
56 -- parse the regexes
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
57 create an AST for regexes
7b982c3 @fglock Perlito5 - update TODO
authored
58
b32dc90 @fglock Perlito5 - update TODO
authored
59 -- prototypes (signatures)
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
60 http://perldoc.perl.org/perlsub.html#Prototypes
61
62 check that undeclared barewords give the right error
63 *foo = sub () { ... } # does prototype work here?
64 check signature in sort()
65 fix the prototype for 'stat(*)' (see t/test.pl in the perl test suite)
fde5276 @fglock Perlito5 - update TODO
authored
66
5f528ed @fglock Perlito5 - parser - more TODO special cases
authored
67 -- "namespace" parsing
131944d @fglock Perlito5 - TODO update; add more references to documentation and tests
authored
68 tests: t5/01-perlito/26-syntax-namespace.t
5f528ed @fglock Perlito5 - parser - more TODO special cases
authored
69
e107c18 @fglock Perlito5 - parser - add "glob variable"
authored
70 $ perl -e ' { package X; sub print { CORE::print(">$_[1]<\n") } } my $x = bless {}, "X"; print $x "xxx" '
71 Not a GLOB reference at -e line 1.
72
73 $ perl -e ' { package X; sub printx { CORE::print(">$_[1]<\n") } } my $x = bless {}, "X"; printx $x "xxx" '
74 >xxx<
75
76 $ perl -MO=Deparse -e ' print X:: "xxx" '
77 print X 'xxx';
78
79 $ perl -e ' use strict; my $x = X::; print $x '
80 X
81
82 $ perl -e ' use strict; my $x = X; print $x '
83 Bareword "X" not allowed while "strict subs" in use
84
daea592 @fglock Perlito5 - add more "use strict"
authored
85 $ perl perlito5.pl -MO=Deparse -e ' ::X::x::y '
86 join("", ::{'main::X::'} x main::y);
87
5f528ed @fglock Perlito5 - parser - more TODO special cases
authored
88 $ perl -MO=Deparse -e ' ::X '
89 '???';
90
91 $ perl -MO=Deparse -e ' sub X {} ::X '
92 sub X { }
93 X;
94
d216d0e @fglock Perlito5 - parser - namespace TODO - more corner cases
authored
95 $ perl -e ' $::X::::X = 3; print $main::X::::X ' # 3
d69c95a @fglock Perlito5 - parser - namespace TODO - more corner cases
authored
96 $ perl -e ' $::X::::X = 3; print $main::main::X::::X ' # 3
97 $ perl -e ' $::X::::X = 3; print $main::X::main::X ' # empty
d216d0e @fglock Perlito5 - parser - namespace TODO - more corner cases
authored
98 $ perl -e ' $::X::::X = 3; print $main::X::X ' # empty
d69c95a @fglock Perlito5 - parser - namespace TODO - more corner cases
authored
99 $ perl -e ' $::X::::X = 3; print $::::X::::X ' # empty
100
bad489f @fglock Perlito5 - parser - TODO list
authored
101 -- CORE:: namespace can be used with operators:
102
103 $ perl -MO=Deparse -e ' $x CORE::and $v '
104 $v if $x;
105
106 $ perl -MO=Deparse -e ' @v = CORE::qw/ a b c / '
107 @v = ('a', 'b', 'c');
108
109 $ perl -MO=Deparse -e ' $x CORE::+ $v '
110 CORE:: is not a keyword
111
d216d0e @fglock Perlito5 - parser - namespace TODO - more corner cases
authored
112
1395266 @fglock Perlito5 - TODO update
authored
113 -- strict and warnings: create options like 'subs', 'refs'
114
94163c8 @fglock perlito5 - parser - tweak TODO list
authored
115 -- clean up:
116 the several "end_tables" in Expression.pm are duplicating the function of
117 $Precedence in Precedence.pm - Expression.pm should use $Precedence directly.
2077216 @fglock Perlito5 - add TODO
authored
118
b33a702 @fglock perlito5 - parser - TODO "things that work in perlito5, but which are…
authored
119 -- things that work in perlito5, but which are errors in 'perl'
120
30e4683 @fglock Perlito5 - TODO update
authored
121 $ perl -e ' my @things= map { no warnings; 123 } @list; '
122 "no" not allowed in expression
123
b33a702 @fglock perlito5 - parser - TODO "things that work in perlito5, but which are…
authored
124 quotes vs. hash lookups:
125
126 $ perl -e ' q}} '
127 # ok
128
129 $ perl -e ' $x{ q}} } '
130 Unmatched right curly bracket at -e line 1, at end of line
131
132 $ perl -e ' $x{ q]] } '
133 # ok
134
135 string interpolation with nested quotes of the same type:
136
137 $ perl -e ' " $x{"x"} " '
138 String found where operator expected at -e line 1, near "x"} ""
139
2cc1933 @fglock Perlito5 - TODO update
authored
140
95e6b6c @fglock Perlito5 - TODO cleanup
authored
141 * Add tests for fixed bugs:
142
143
144 ---
145 add additional variants of "for"
146
147 # "our" with localization
148 $ perl -e ' use strict; our $x = 123; for our $x (1,2,3) { 2 } print "$x\n" '
149 123
150
151 # variable in scope with localization
152 $ perl -e ' use strict; my $x = 123; for $x (1,2,3) { 2 } print "$x\n" '123
153 123
154
155
156 ---
157 add "print", "printf", "say" special parsing - note this is related to indirect object notation
158
159 indirect object notation
160 http://lwn.net/Articles/451486/
161 http://www.modernperlbooks.com/mt/2009/08/the-problems-with-indirect-object-notation.html
162 http://shadow.cat/blog/matt-s-trout/indirect-but-still-fatal/
163 http://perlbuzz.com/mechanix/2008/02/the-perils-of-perl-5s-indirect.html
164
165 method Module $param;
166 new Class( arg => $value );
167 new Class::($args);
168 say $config->{output} "This is a diagnostic message!"; # indirect call
169 say {$config->{output}} "This is a diagnostic message!"; # say to filehandle
170
171 use Class;
172 sub Class {
173 warn 'Called Class sub not Class package';
174 'Class'
175 }
176 my $q = Class->new; # calls the Class sub above
177 my $s = new Class; # throws a 'Bareword found where operator expected' error
178 my $t = Class::->new # this works
179 my $u = new Class::; # this also works (even with sub main in the current package)
180
181 sbertrang++ noted this is also valid:
182 print( STDERR "123" )
183
184
185 ---
94163c8 @fglock perlito5 - parser - tweak TODO list
authored
186 add tests for signatures: "empty" _ $ ;$
187
188 ---
caf3b30 @fglock perlito5 - parser - fix "sub _" should be in package "main"
authored
189 add test for "sub _" should be in package "main"
190 $ perl -MO=Deparse -e ' package X; sub _ { 123 } '
191 package X;
192 sub main::_ {
193 123;
194 }
195
196 ---
197 add test for defined-or vs. m// (2012/9/25 Конрад Боровски <notifications@github.com>)
198 Note: fixed; see test t5/01-perlito/25-syntax-defined-or.t
199
200 $ perl perlito5.pl -Isrc5/lib -Cast-perl5 -e ' shift // 2 '
201 Number or Bareword found where operator expected
202
203 $ perl perlito5.pl -Isrc5/lib -Cast-perl5 -e ' shift / 2 '
204 Can't find string terminator '/' anywhere before EOF
205
206 ---
207 add test for filetest operators special case:
2cc1933 @fglock Perlito5 - TODO update
authored
208 ' -f($file).".bak" ' should be equivalent to -f "$file.bak"
209 parses as -(f($file)).".bak"
210 but: ' -f ($file).".bak" '
211 parses correctly
212 This seems to be because there is a rule that \w followed by '(' is a function call;
213 this needs more testing: ' ... and(2) '
dd7a160 @fglock Perlito5 - parser: fix a bug caused by incorrect is_term state
authored
214 Test: redefine 'and', 'not' and check what works.
2cc1933 @fglock Perlito5 - TODO update
authored
215
216 ' $s111++ + $s222 '
217 parses as (+$s222)++
218
dd7a160 @fglock Perlito5 - parser: fix a bug caused by incorrect is_term state
authored
219 ' $step++ < $steps '
220 Can't find string terminator '>' anywhere before EOF
221
2cc1933 @fglock Perlito5 - TODO update
authored
222
8f67bea @fglock Perlito version 8.0
authored
223
5bb50dd @fglock Perlito5 - update TODO
authored
224 * Perl5 backend
399a3d2 @fglock Perlito5 - use scalar() instead of .elems()
authored
225
7bc739e @fglock Perlito5 - parser - add 'Perlito5::AST::Given'
authored
226 -- "given" statement not implemented
376e088 @fglock Perlito5 - TODO update
authored
227 -- "default" statement not implemented
7bc739e @fglock Perlito5 - parser - add 'Perlito5::AST::Given'
authored
228
66ec858 @fglock Perlito5 - TODO update
authored
229 -- check that \(@a) and \@a have different meanings
230
529225f @fglock Perlito5 - TODO update
authored
231 -- ${^NAME} needs curly-escaping
232
85c5759 @fglock Perlito5 - TODO update
authored
233 - fix regex delimiters, or escape the regexes
234
47374c7 @fglock Perlito5 - perl5: fix bareblock
authored
235 -- continue block in block: ' { print 1 } continue { print 2 } '
236
7a5d100 @fglock Perlito5 - perl5: document emitter bug (significant parenthesis)
authored
237 -- emitter bug: significant parenthesis:
238 t5/01-perlito/12-context.t fails because:
239 " return (4, 5) " instead of " return 4, 5 "
240
1d5cf89 @fglock Perlito5 - parser: new module Perlito5::Grammar::Sigil
authored
241 -- bug: ' $$x [$y] '
242 emits as ${$x}->[$y];
243
0cc64c5 @fglock Perlito5 - kill perl6-ish "method"
authored
244
8f67bea @fglock Perlito version 8.0
authored
245 * Javascript backend
246
21af3dc @fglock Perlito5 - js - TODO update
authored
247 -- unary minus
248 special cases for string and bareword
249
250 -- '&' prototype
251 add tests; see Try::Tiny
252
253 -- AUTOLOAD() called from UNIVERSAL autovivifies packages
254 add tests
255
30e4683 @fglock Perlito5 - TODO update
authored
256 -- code emitter for first argument of sort() and grep()
257
258 -- prototype() can be set by aliasing:
259 *x = sub ($$) { 123 }; *y = *x; print prototype(\&y) # $$
260
66ec858 @fglock Perlito5 - TODO update
authored
261 -- check that \(@a) and \@a have different meanings
262
09cc8db @fglock Perlito5 - js - add TODO for delete() special case
authored
263 -- delete() in the middle of an array turns exists() off:
264
265 $ perl -e ' @a = (3..7); delete $a[2]; print "exists ", (exists $a[$_] ? 1 : 0), "\n" for 0 .. $#a '
266 exists 1
267 exists 1
268 exists 0
269 exists 1
270 exists 1
271
3b69c4e @fglock Perlito5 - javascript - add bug: "return" and context inside eval
authored
272 -- "or" has SCALAR context (Abigail++):
25440bb @fglock Perlito5 - TODO update
authored
273 See: t5/01-perlito/23-eval.t
3b69c4e @fglock Perlito5 - javascript - add bug: "return" and context inside eval
authored
274
ecbc8f4 @fglock Perlito5 - TODO update; fix "when"
authored
275 -- "~~" operator not implemented; See also "when" implementation
276
277 -- "given" statement not implemented
376e088 @fglock Perlito5 - TODO update
authored
278 -- "when" should use a "break" exception inside "given", and a "next" exception inside "for".
ecbc8f4 @fglock Perlito5 - TODO update; fix "when"
authored
279 -- "default" statement not implemented
280
db64ad6 @fglock Perlito5 - parser: "C-style" loop
authored
281 -- bug: some declarations are not "seen":
282 for ( my $i = 0; $i < 10 ; $i++ ) { print "$i\n" } # compiles to global $i
283
bb77986 @fglock Perlito5 - parser: optimize ident() rule
authored
284 -- bug: don't emit throw() in term position; javascript requires a function() wrapper because throw() is a statement
285
9f9d0dd @fglock Perlito5 - javascript: TODO update
authored
286 -- javascript errors don't show in the global error handler when running in node.js
7a03ff4 @fglock Perlito5 - javascript: eval-block works
authored
287
e584da6 @fglock Perlito5 - javascript: TODO update
authored
288 -- "autoload" the compiler if eval-string is used (eval-string needs the compiler at run-time)
289
529225f @fglock Perlito5 - TODO update
authored
290 -- symbol variables like $] ${"main::\$"} $#_
291 -- check that @_, $_, $a, $b and other special variables are in the right context (lexical, global, package global)
292
014a584 @fglock Perlito5 - javascript: working @ISA; update Changelog, examples
authored
293 -- add alternate mro's
85c5759 @fglock Perlito5 - TODO update
authored
294 -- cache the mro
42a3449 @fglock Perlito5 - TODO update
authored
295
296 -- add regex compiler
297 -- /e modifier
d2169b7 @fglock Perlito5 - t/test.pl: use cmp_ok()
authored
298 -- /x modifier
42a3449 @fglock Perlito5 - TODO update
authored
299 -- support all perl5 regex syntax
529225f @fglock Perlito5 - TODO update
authored
300 -- @v = /x/g
42a3449 @fglock Perlito5 - TODO update
authored
301
887219b @fglock Perlito5 - javascript: work around variable redeclaration bug
authored
302 -- bug: variable redeclaration does not work
303 -- javascript "var" erases the outer value within the whole current lexical scope
42a3449 @fglock Perlito5 - TODO update
authored
304 -- bug: "my" variables - this doesn't work as expected: my $v = $v
305 possible fix: rename variables
887219b @fglock Perlito5 - javascript: work around variable redeclaration bug
authored
306
b75827a @fglock Perlito5 - TODO update
authored
307 -- lvalue ternary: ($a_or_b ? $a : $b) = $c;
308 -- lvalue substr()
309 -- 4-arguments substr()
78fd976 @fglock Perlito5 - javascript: fix 3-arguments substr()
authored
310 -- pos($str)
b44f592 @fglock Perlito5 - TODO update
authored
311 -- lvalue chomp(), chop()
78fd976 @fglock Perlito5 - javascript: fix 3-arguments substr()
authored
312
313 -- missing some types of subroutine signatures
5b56e5b @fglock Perlito5 - change javascript calling convention
authored
314
8f67bea @fglock Perlito version 8.0
authored
315 -- bug: variable aliases create copies instead
316
ce36bd0 @fglock Perlito5 - update TODO
authored
317 -- generate more compact code; maybe use more subroutines instead of inlining;
318 autovivification is probably the most verbose part of the code.
ae7ad72 @fglock Perlito5 - update docs
authored
319
7b982c3 @fglock Perlito5 - update TODO
authored
320 -- in the browser: implement "use" with XMLHttpRequest (what are the security implications?)
4b15a00 @fglock Perlito5 - cleanup parenthesis
authored
321
5bb50dd @fglock Perlito5 - update TODO
authored
322 -- add symbol tables for scalar, array and hash
1b4e7ee @fglock Perlito5 - TODO update: typeglobs
authored
323 -- references to typeglobs:
324 $ perl -e ' print ref(\*main) '
325 GLOB
326 -- aliasing between lexicals and globals
327 $ perl -e 'use strict; my $x = 3; *main::z = \$x; print $main::z; '
328 3
5bb50dd @fglock Perlito5 - update TODO
authored
329
71b0905 @fglock Perlito5 - docs update
authored
330 -- string increment and string ranges
e09904a @fglock Perlito5 - javascript: infrastructure for string increment
authored
331 See: p5str_inc()
5b56e5b @fglock Perlito5 - change javascript calling convention
authored
332
0e5b55f @fglock Perlito5 - update TODO
authored
333 -- finish "overload" implementation
334
0718f37 @fglock Perlito5 - javascript: TODO update
authored
335 -- pack(), unpack()
336 -- y()()
337
b343129 @fglock Perlito - TODO update
authored
338 -- BEGIN{} should execute in the environment of the program under compilation
88914e1 @fglock Perlito5 - TODO update
authored
339 -- BEGIN/END that are defined inside blocks/closures need to run inside some pseudo-environment
340 even if the closure was never created or used in the first place
b343129 @fglock Perlito - TODO update
authored
341
b371c5d @fglock Perlito5 - js - AUTOLOAD finished; add tests; workaround for broken b…
authored
342 -- bug - method call context is disabled, because it breaks bootstrap.
343 in Runtime.pm:
344 function p5call(invocant, method, list, p5want) {
345 list.unshift(invocant);
346 p5want = 0; // TODO BUG - workaround for broken bootstrap
0cc64c5 @fglock Perlito5 - kill perl6-ish "method"
authored
347
39fbeed @fglock Perlito5 - TODO update
authored
348 -- bug https://github.com/fglock/Perlito/issues/10
349 "Perlito 5 JS has syntax errors"
350
351 Tried
352
353 YUI Compressor online
354 and
355 Google Closure Compiler
356 http://closure-compiler.appspot.com/home
357
358 Both failed with syntax errors.
359
9643c62 @fglock Perlito5 - TODO update
authored
360 -- flip-flop operator
361 if either operand to scalar '..' is a constant the value is implicitly compared to the input line number ($.)
362
363 -- unary minus on strings.
364
365 my $_ = "a"
366 print -$_
367 # -a
368
e4182ba @fglock Perlito5 - TODO update
authored
369 my $foo = '-bar';
370 print $foo;
371 print -$foo;
372 # -bar+bar
373
59477ad @fglock Perlito - TODO update
authored
374
fb9190c @fglock Perlito5 - TODO update
authored
375 * Nice to Have
a7ab071 @fglock Perlito5 - add TODO
authored
376
3c87580 @fglock Perlito - TODO update
authored
377 -- debugging symbols
378 -- line numbers in error messages
379
8f60cb4 @fglock Perlito5 - TODO update
authored
380 -- caller()
381 -- "when"
465ee11 @fglock Perlito5 - TODO update
authored
382
fb9190c @fglock Perlito5 - TODO update
authored
383 -- run more of the "perl" test suite
0cc64c5 @fglock Perlito5 - kill perl6-ish "method"
authored
384
71b0905 @fglock Perlito5 - docs update
authored
385 -- proper "use strict" and "use warnings"
1b2eecc @fglock Perlito5 - use @ARGV instead of @*ARGS
authored
386 -- use the same error messages and warnings as 'perl'
42a3449 @fglock Perlito5 - TODO update
authored
387 -- no warnings 'redefine';
1b2eecc @fglock Perlito5 - use @ARGV instead of @*ARGS
authored
388
ebce10f @fglock Perlito5 - parser: add __END__, __DATA__
authored
389 -- __LINE__, __FILE__
f4910a7 @fglock Perlito5 - TODO update
authored
390
b343129 @fglock Perlito - TODO update
authored
391 -- INIT{}, END{}
392 look at the implementation in perlito6-in-Go
f4910a7 @fglock Perlito5 - TODO update
authored
393
4b15a00 @fglock Perlito5 - cleanup parenthesis
authored
394 -- source code - remove Perl 6 code such as "token"
71b0905 @fglock Perlito5 - docs update
authored
395 (fixed: This is only loaded if the grammar compiler is needed)
4b15a00 @fglock Perlito5 - cleanup parenthesis
authored
396
61d64aa @fglock Perlito5 - parser: rewrite operator() in "perl5-land" for later tweaking
authored
397 -- *{ $name }{CODE}->();
398
399 -- local(*{$caller."::a"}) = \my $a;
6217752 @fglock Perlito5 - docs update
authored
400 -- *{$pkg . "::foo"} = \&bar;
61d64aa @fglock Perlito5 - parser: rewrite operator() in "perl5-land" for later tweaking
authored
401
402
9643c62 @fglock Perlito5 - TODO update
authored
403 * Oddities
404
405 -- from moritz, Schwern and others at
406 http://stackoverflow.com/questions/161872/hidden-features-of-perl
407
408 - you can give subs numeric names if you use symbolic references
409
410 $ perl -lwe '*4 = sub { print "yes" }; 4->()'
411 yes
412
413 - you can use letters as delimiters
414
415 $ perl -Mstrict -wle 'print q bJet another perl hacker.b'
416 Jet another perl hacker.
417
418 Likewise you can write regular expressions:
419
420 m xabcx
421 # same as m/abc/
422
423 The "desperation mode" of Perl's loop control constructs which causes them to look up the stack to find a matching label allows some curious behaviors which Test::More takes advantage of, for better or worse.
424
425 SKIP: {
426 skip() if $something;
427
428 print "Never printed";
429 }
430
431 sub skip {
432 no warnings "exiting";
433 last SKIP;
434 }
435
d6cad9b @fglock Perlito5 - TODO update
authored
436
437 * Deprecate
438
439 -- remove unused features from src5/lib/Perlito5/Grammar/Regex.pm
440
441 -- Interpreter backend
442 this is not being maintained; the code is still in src5/lib/Perlito5/Eval.pm just in case
443
444 -- Perl6 backend (started)
445 this is not being maintained; not sure if compiling to Perl6 is the best way
446 maybe compiling directly to Parrot/dotnet/Haskell gives better results
447
Something went wrong with that request. Please try again.