Hacker News new | ask | show | jobs
by dtech 2050 days ago
I'd say that holds about as much value as criticizing C-style languages for allowing all these variants

    if(x) true
    if(x)
      true
    if(x) (true)
    if(x) {true}
    if(x) {
      true
    }
    if(x)
    {
      true
    }
etc. In practice you use a linter to enforce a style and it's not a problem.

For the curious. The combinations follow out of fairly simple rules:

    () and {} are interchangeable for expressions - altough {} can contain multiple statements and () only an expression.
    x op y is equivalent to x.op(y)
    Type abscriptions - x : Type - are optional and will be inferred if possible
    { case ... } is the pattern match construct and works similarly to a function with 1 parameter.