<div><font face="courier new, monospace">I've been trying to upgrade our PS version and have some problems to</font></div><div><font face="courier new, monospace">report. This email concerns issues with the changes to the printer in</font></div>

<div><font face="courier new, monospace">commit </font><span style="font-family:'courier new',monospace">60154a</span><font face="courier new, monospace">. Accordingly, the code samples below need to be</font></div>

<div><font face="courier new, monospace">formatted in a fixed-width font to be readable. Also, they're all in</font></div><div><font face="courier new, monospace">JS rather than PS for obvious reasons. I can provide the corresponding</font></div>

<div><font face="courier new, monospace">PS forms if desired.</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">First, a simple for loop used to be printed like this:</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">   for (var n = 0; n < 10; n += 1) {</font></div><div><font face="courier new, monospace">       blah(n);</font></div>
<div>
<font face="courier new, monospace">   };</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">is now:</font></div><div><font face="courier new, monospace"><br></font></div>

<div><font face="courier new, monospace">   for (var n = 0; n < 10;</font></div><div><font face="courier new, monospace">        n += 1) {</font></div><div><font face="courier new, monospace">       blah(n);</font></div>

<div><font face="courier new, monospace">   };</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Not sure if that was intended, but it's so nonstandard that I can't</font></div>

<div><font face="courier new, monospace">bear to look at it. If one were going to put line breaks in the for</font></div><div><font face="courier new, monospace">loop declaration, surely there ought to be a line per clause rather</font></div>

<div><font face="courier new, monospace">than an arbitrary break between the second and third. But three lines</font></div><div><font face="courier new, monospace">is too many and anyway the whole thing is weird; it really belongs</font></div>

<div><font face="courier new, monospace">on one line.</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Second, there seem to be bugs in how expressions in a comma-delimited</font></div>

<div><font face="courier new, monospace">list are line-separated and indented. Apologies for the contrived JS</font></div><div><font face="courier new, monospace">here, but I have to make the lines long enough to trigger an</font></div>

<div><font face="courier new, monospace">indentation. Code that used to be in one line like this:</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">   var obj = (obj3433 = {  }, (obj3433.foooooooooooo = 'oooooooooooooooooooooooooooooooo', obj3433.baaaaaaaaar = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', obj3433));</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">is now being indented like this:</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">   var obj = (obj3433 = {  },</font></div>

<div><font face="courier new, monospace">              (obj3433.foooooooooooo = 'oooooooooooooooooooooooooooooooo',</font></div><div><font face="courier new, monospace">obj3433.baaaaaaaaar = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', obj3433));</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">I like the idea, but it seems the third (and any subsequent) lines</font></div><div><font face="courier new, monospace">ought to be aligned with the second.</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Here's a real example of the same problem from our code:</font></div><div><font face="courier new, monospace"><br></font></div>

<div><font face="courier new, monospace">        var bucket = (g4 = m1 - sol[label],</font></div><div><font face="courier new, monospace">                      (g5 = m2 - sol[label],</font></div><div><font face="courier new, monospace"> (g6 = rcplus === 'col' ? rect3437[0] : rect3437[2],</font></div>

<div><font face="courier new, monospace"> (g7 = rcplus === 'col' ? rect3437[1] : rect3437[3],</font></div><div><font face="courier new, monospace"> rc === 'col' ? [g4, g5, g6, g7] : [g6, g7, g4, g5]))));</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">There are other more complex examples of nested grouped expressions</font></div><div><font face="courier new, monospace">that are coming out pretty strangely:</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    var sh = (</font></div><div><font face="courier new, monospace">              obj3439 = { markup : packIgrid(markup), tiling : csh.tiling, ultc : ultc,</font></div>

<div><font face="courier new, monospace">         ultr : ultr },</font></div><div><font face="courier new, monospace">              (</font></div><div><font face="courier new, monospace"> (g3 = (it = csh.coldeltas, it != null && it !== false ? xcopy(it) : null),</font></div>

<div><font face="courier new, monospace"> g3 != null ? (obj3439.coldeltas = g3) : null),</font></div><div><font face="courier new, monospace"> (</font></div><div><font face="courier new, monospace"> g4 = (it3440 = csh.rowdeltas,</font></div>

<div><font face="courier new, monospace">   it3440 != null && it3440 !== false ? xcopy(it3440) : null),</font></div><div><font face="courier new, monospace"> g4 != null ? (obj3439.rowdeltas = g4) : null),</font></div>

<div><font face="courier new, monospace"> obj3439));</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">It does seem like a good idea to not have all this on one line, but</font></div>

<div><font face="courier new, monospace">it's far from clear what the indentation policy is.</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Similar inconsistencies afflict curly braces:</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">   queueMsg(brl, {</font></div><div><font face="courier new, monospace">                   acknowledge : true }, mailbox);</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">or:</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    return ss.appointmentTicket = { col : c + (cols || 0),</font></div>

<div><font face="courier new, monospace">                                 row : r + (rows || 0) };</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">and here's a monster one:</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">var REGRESSIONS = [{ type : 'js', target : 'ff', file1 : 'f1', file2 : 'f2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                 type : 'js',</font></div><div><font face="courier new, monospace">                                                                                 target : 'ie6',</font></div>

<div><font face="courier new, monospace">                                                                                 file1 : 'ie61',</font></div><div><font face="courier new, monospace">                                                                                 file2 : 'ie62' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                     type : 'js',</font></div><div><font face="courier new, monospace">                                                                                                     target : 'ie7',</font></div>

<div><font face="courier new, monospace">                                                                                                     file1 : 'ie71',</font></div><div><font face="courier new, monospace">                                                                                                     file2 : 'ie72' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                         type : 'js',</font></div><div><font face="courier new, monospace">                                                                                                                         target : 'ie8',</font></div>

<div><font face="courier new, monospace">                                                                                                                         file1 : 'ie81',</font></div><div><font face="courier new, monospace">                                                                                                                         file2 : 'ie82' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                             type : 'js',</font></div><div>
<font face="courier new, monospace">                                                                                                                                             target : 'safari',</font></div>
<div><font face="courier new, monospace">                                                                                                                                             file1 : 'saf1',</font></div><div>

<font face="courier new, monospace">                                                                                                                                             file2 : 'saf2' }, {</font></div><div>

<font face="courier new, monospace">                                                                                                                                                                 type : 'js',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                 target : 'chrome',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                 file1 : 'chr1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                 file2 : 'chr2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                     type : 'js',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                     target : 'node',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                     file1 : 'n1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                     file2 : 'n2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                       type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                       target : 'ff',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                       file1 : 'hf1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                       file2 : 'hf2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                          type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                          target : 'ie6',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                          file1 : 'hie61',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                          file2 : 'hie62' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                               type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                               target : 'ie7',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                               file1 : 'hie71',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                               file2 : 'hie72' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                    type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                    target : 'ie8',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                    file1 : 'hie81',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                    file2 : 'hie82' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                         type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                         target : 'safari',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                         file1 : 'hsaf1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                         file2 : 'hsaf2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                              type : 'html',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                              target : 'chrome',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                              file1 : 'hchr1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                              file2 : 'hchr2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                   type : 'css',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                   target : 'chrome',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                   file1 : 'c1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                   file2 : 'c2' }, {</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                                     type : 'css',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                                     target : 'ie8',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                                     file1 : 'ie1',</font></div>

<div><font face="courier new, monospace">                                                                                                                                                                                                                                                                                                                                                     file2 : 'ie2' }];</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">I have some respect for how much harder this problem is than it</font></div><div><font face="courier new, monospace">appears to be, having worked on similar issues for our Numen REPL and</font></div>

<div><font face="courier new, monospace">not being too happy with what I came up with. That being said, these</font></div><div><font face="courier new, monospace">changes to the printer probably make the JS less readable in our case</font></div>

<div><font face="courier new, monospace">rather than more readable. It would be better to do less and have it</font></div><div><font face="courier new, monospace">be consistent. At a minimum, I hope we can fix the more indecorous</font></div>

<div><font face="courier new, monospace">areas.</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Daniel</font></div><div><font face="courier new, monospace"><br>

</font></div><div><font face="courier new, monospace"><br></font></div><div><br></div>