Ruud H.G. van Tol on Sat, 01 Nov 2025 14:29:52 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Comments between lines raise syntax error



On 2025-11-01 13:19, Karim Belabas wrote:
> [...] I advise to use { ... } for complicated multi-line statements instead of a > line continuation \. The latter works best for a very small number of lines.
> [...]
>
>   {
>     level4 = [
>     e4,
>     /* Level 1 multiplied by Level 3 */
>     z1*z5,
>     z1*z6,
>     z1*z7,
>     /* Level 2 multiplied by itself */
>     z2*z2,
>     z2*z3,
>     z3*z3
>     ];
>   }
> [...]


As an alternative style, also consider:

  { my
    ( level4 =
      [ e4
        /* Level 1 multiplied by Level 3 */
      , z1 * z5
      , z1 * z6
      , z1 * z7
        /* Level 2 multiplied by itself */
      , z2 * z2
      , z2 * z3
      , z3 * z3
      ]
    );
  }

which (for me) works out very clean with many languages and version-control-systems.

Search on "leading comma format" and "comma first style" for more details.

-- Ruud

P.S. maybe call it "Hungarian punctuation" :)