<div>I pushed a refactoring patch (4a55356 - reproduced below) that</div><div>needs some review.</div><div><br></div><div>The idea is that the equality operators don't need to be printed</div><div>differently from the other operators. They were, in order to allow for</div>


<div>a function #'parenthsize-equality to ensure that expressions like </div><div>(= (= a b) c) and (= a (= b c)) are printed with parenthesized operands.</div><div>However, as I read the code, there is no possibility that the default</div>


<div>operator printer would ever not parenthesize those operands. In</div><div>other words, the mechanism is superfluous. A further explanation</div><div>is given in the commit message below.</div><div><br></div><div>All the tests pass and I observe no change in the compiled output of</div>


<div>our application, but this is still the kind of change that someone</div><div>should look over.</div><div><br></div><div>Daniel</div><div><br></div><div><br></div><div>commit 4a55356d6d09715fbd10a01c1b9019e013e42663</div>


<div>Author: Daniel Gackle <<a href="mailto:danielgackle@gmail.com" target="_blank">danielgackle@gmail.com</a>></div><div>Date:   Sun Feb 24 17:09:41 2013 -0700</div><div><br></div><div>    Refactoring: got rid of PARENTHESIZE-EQUALITY.</div>


<div>    </div><div>    There is no need for PARENTHESIZE-EQUALITY as distinct from</div><div>    PRINT-OP-ARGUMENT, because the latter always parenthesizes equality</div><div>    expressions when they are an operand in some other equality</div>


<div>    expression. (In such a case, OP and ARG-OP have the same precedence,</div><div>    and neither is associative.)</div><div><br></div><div>diff --git a/src/printer.lisp b/src/printer.lisp</div><div>index 348f55a..f07a5b2 100644</div>


<div>--- a/src/printer.lisp</div><div>+++ b/src/printer.lisp</div><div>@@ -145,10 +145,8 @@ vice-versa.")</div><div> (defmethod ps-print ((number number))</div><div>   (format *psw-stream* (if (integerp number) "~D" "~F") number))</div>


<div> </div><div>-(defvar %equality-ops '(ps-js:== ps-js:!= ps-js:=== ps-js:!==))</div><div>-</div><div> (let ((precedence-table (make-hash-table :test 'eq)))</div><div>-  (loop for level in `((ps-js:getprop ps-js:aref ps-js:funcall)</div>


<div>+  (loop for level in '((ps-js:getprop ps-js:aref ps-js:funcall)</div><div>                        (ps-js:new)</div><div>                        (ps-js:lambda) ;; you won't find this in JS books</div><div>                        (ps-js:++ ps-js:-- ps-js:post++ ps-js:post--)</div>


<div>@@ -157,7 +155,7 @@ vice-versa.")</div><div>                        (ps-js:- ps-js:+)</div><div>                        (ps-js:<< ps-js:>> ps-js:>>>)</div><div>                        (ps-js:< ps-js:> ps-js:<= ps-js:>= ps-js:instanceof ps-js:in)</div>


<div>-                       ,%equality-ops</div><div>+                       (ps-js:== ps-js:!= ps-js:=== ps-js:!==)</div><div>                        (ps-js:&)</div><div>                        (ps-js:^)</div><div>

                        (ps-js:\|)</div>
<div>@@ -218,21 +216,12 @@ vice-versa.")</div><div> (defprinter ps-js:post-- (x)</div><div>   (ps-print x)"--")</div><div> </div><div>-(defprinter (ps-js:+ ps-js:- ps-js:* ps-js:/ ps-js:% ps-js:&& ps-js:\|\| ps-js:& ps-js:\| ps-js:-= ps-js:+= ps-js:*= ps-js:/= ps-js:%= ps-js:^ ps-js:<< ps-js:>> ps-js:&= ps-js:^= ps-js:\|= ps-js:= ps-js:in ps-js:> ps-js:>= ps-js:< ps-js:<=)</div>


<div>+(defprinter (ps-js:+ ps-js:- ps-js:* ps-js:/ ps-js:% ps-js:&& ps-js:\|\| ps-js:& ps-js:\| ps-js:-= ps-js:+= ps-js:*= ps-js:/= ps-js:%= ps-js:^ ps-js:<< ps-js:>> ps-js:&= ps-js:^= ps-js:\|= ps-js:= ps-js:in ps-js:> ps-js:>= ps-js:< ps-js:<= ps-js:== ps-js:!= ps-js:=== ps-js:!==)</div>


<div>     (&rest args)</div><div>   (loop for (arg . remaining) on args do</div><div>        (print-op-argument op arg)</div><div>        (when remaining (format *psw-stream* " ~(~A~) " op))))</div><div> </div>


<div>-(defprinter (ps-js:== ps-js:!= ps-js:=== ps-js:!==) (x y)</div><div>-  (flet ((parenthesize-equality (form)</div><div>-           (if (and (consp form) (member (car form) %equality-ops))</div><div>-               (parenthesize-print form)</div>


<div>-               (print-op-argument op form))))</div><div>-    (parenthesize-equality x)</div><div>-    (format *psw-stream* " ~A " op)</div><div>-    (parenthesize-equality y)))</div><div>-</div><div> (defprinter ps-js:aref (array &rest indices)</div>


<div>   (print-op-argument 'ps-js:aref array)</div><div>   (dolist (idx indices)</div><div><br></div>