js_of_ocaml icon indicating copy to clipboard operation
js_of_ocaml copied to clipboard

[FEATURE REQUEST] Nicer pretty-printing

Open copy opened this issue 8 years ago • 0 comments

The output of the --pretty still looks quite dense, in particular:

  • There should be spaces around all binary operators and after ,, :, ), ;
  • The last semicolon shouldn't be omitted
  • The placing of { and } is odd, e.g.:
    function caml_string_notequal(s1, s2)
     {return 1 - caml_string_equal(s1, s2)}
  • Sometimes long expressions are printed vertically, for example in caml_utf8_of_utf16:
           (c
            >=
            56319
            ||
            i
            +
            1
            ==
            l
            ||
            (d = s.charCodeAt(i + 1))
            <
            56320
            ||
            d
            >
            57343)

And some more subjective points:

  • Braces after single-statement if, while, etc. shouldn't be omitted
  • Declare each variable with a var instead of grouping them with , (reference)

copy avatar Nov 21 '17 17:11 copy