Added some more items to the TODO file
[parenscript.git] / TODO.org
blob69305906af15a2299ac8b4864a388f17e76c56b1
1 * ChangeLog and NEWS files
2   git2cl
3 * Replace :use in packages with explicit imports
4 * ASDF3 test-op and best practices for system definitions
5 * Fix BREAKing out of LOOP
6 https://github.com/vsedach/Parenscript/issues/43
8 (ps:ps
9 (defun foo (t1 t5)
10   (loop for t2 in t1
11      for t4 in t5
12      collect (loop for t3 in t2 collect t3))))
14 generates
16 function foo(t1, t5) {
17     __PS_MV_REG = [];
18     return (function () {
19         var _js54 = t1.length;
20         var _js56 = t5.length;
21         var collect57 = [];
22         var FIRST58 = true;
23         for (var _js53 = 0; _js53 < _js54; _js53 += 1) {
24             (function () {
25                 var t2 = t1[_js53];
26                 var _js55 = FIRST58 ? 0 : _js55 + 1;
27                 if (_js55 >= _js56) {
28                     break;
29                 };
30                 var t4 = t5[_js55];
31                 collect57.push((function () {
32                     var _js60 = t2.length;
33                     var collect61 = [];
34                     for (var _js59 = 0; _js59 < _js60; _js59 += 1) {
35                         var t3 = t2[_js59];
36                         collect61.push(t3);
37                     };
38                     __PS_MV_REG = [];
39                     return collect61;
40                 })());
41                 __PS_MV_REG = [];
42                 return FIRST58 = null;
43             })();
44         };
45         __PS_MV_REG = [];
46         return collect57;
47     })();
50 Note that the entire outer-loop body is inside a js function but it still contains break statements.
52 Reverting e6489e0 fixes this issue.
54 This is reduced from a regression in real-world code.
55 @jasom
56 Collaborator Author
57 jasom commented on Jan 11
59 As ECMA script 6 supports block scoping via "let" the only way I see of implementing this would be to wrap the loop in a try and change the break to be a throw. Or we could just not support strict mode and go back to using with (which provides the scoping).
60 @jasom
61 Collaborator Author
62 jasom commented on Jan 11 •
64 Actually for this example "break" could be turned into "return" since the entire loop body is a function.
66 The above doesn't terminate the loop; rather the loop would have to be inside the function and then break could just be used anyways. My comment below is still true.
68 I don't know enough about the loop implementation to say if this works for the general case.
69 @vsedach
70 Owner
71 vsedach commented on Jan 11
72  As ECMA script 6 supports block scoping via "let" the only way I
73  see of implementing this would be to wrap the loop in a try and
74  change the break to be a throw.
75 Correct. I think Parenscript's LOOP is not doing a RETURN-FROM, which
76 would generate a throw in cases like this.
77 @jasom
78 Collaborator Author
79 jasom commented on Jan 17
81 I locally fixd the BREAK to use RETURN-FROM and it gets worse; note that var _js55 = FIRST58 ? 0 : _js55 + 1; is inside the lambda, so js55 is zero on the first iteration and NaN thereafter.
83 Previously only the non-gensymed variables were declared in the with block so the gensym variables took the outer scope; this obviously is not what happens when you replace the with with a lambda. The fix is likely going to involve hoisting those variable declarations out of the loop body; I'm busy with other things currently so it may take several days before I report back.
84 * Add DOM3 and DOM4 symbols to PS-DHTML-SYMBOLS
85   https://github.com/vsedach/Parenscript/issues/14
86 * Merge ZEROP, FORMAT from https://github.com/mgi/Parenscript
87 * Add ECMAScript 2015 support
88   https://github.com/pjstirling/Parenscript