1 * Fix BREAKing out of LOOP
2 https://github.com/vsedach/Parenscript/issues/43
8 collect (loop for t3 in t2 collect t3))))
12 function foo(t1, t5) {
15 var _js54 = t1.length;
16 var _js56 = t5.length;
19 for (var _js53 = 0; _js53 < _js54; _js53 += 1) {
22 var _js55 = FIRST58 ? 0 : _js55 + 1;
27 collect57.push((function () {
28 var _js60 = t2.length;
30 for (var _js59 = 0; _js59 < _js60; _js59 += 1) {
38 return FIRST58 = null;
46 Note that the entire outer-loop body is inside a js function but it still contains break statements.
48 Reverting e6489e0 fixes this issue.
50 This is reduced from a regression in real-world code.
53 jasom commented on Jan 11
55 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).
58 jasom commented on Jan 11 •
60 Actually for this example "break" could be turned into "return" since the entire loop body is a function.
62 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.
64 I don't know enough about the loop implementation to say if this works for the general case.
67 vsedach commented on Jan 11
68 As ECMA script 6 supports block scoping via "let" the only way I
69 see of implementing this would be to wrap the loop in a try and
70 change the break to be a throw.
71 Correct. I think Parenscript's LOOP is not doing a RETURN-FROM, which
72 would generate a throw in cases like this.
75 jasom commented on Jan 17
77 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.
79 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.
80 * Fix multiple COLLECT clauses in LOOP
81 https://github.com/vsedach/Parenscript/issues/46
83 phmarek commented 7 hours ago
86 (loop for i from 0 to 3
87 for ch = (char "abcde" i)
88 for p = (char-code ch)
89 collect (logand (ash p -1) 1)
90 collect (logand (ash p -0) 1)))
97 for (var i = 0; i <= 3; i += 1) {
98 var ch = char('abcde', i);
100 collect41.push(p >> 1 & 1);
101 collect41.push(p >> 0 & 1);
107 Please note the duplicated var collect41 statements.
109 I don't think this breaks JS, but at least it is ugly.
110 * Add DOM3 and DOM4 symbols to PS-DHTML-SYMBOLS
111 https://github.com/vsedach/Parenscript/issues/14
112 * Merge ZEROP, FORMAT from https://github.com/mgi/Parenscript
113 * Add ECMAScript 2015 support
114 https://github.com/pjstirling/Parenscript