News for hackers. Stuff that matters.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by User3456335 on Thursday August 24, 2023 @06:47PM (#37255547)
> Zimbu’s trademark feature was the way it let coders omit the opening curly brace around a block of code. (“It looks a bit weird maybe, at first…” Moolenaar acknowledged to the audience. “Get used to it. It will work out fine.”)

Hahahaha, this is what we needed: a programming language with unmatched braces because the opening brace can be inferred from context... Well, no surprise that this is coming from the Vim creator.

Re:Vim creator Bram Moolenaar's forgotten programming langua... by sph on Thursday August 24, 2023 @07:20PM (#37255812)
Not that dumb as one might think. What is the purpose of the opening brace after a function declaration in C, for example? It's the only token accepted, so its sole purpose is symmetry with the closing brace, which has an actual purpose.

So it might look silly, but there is no deep reason it couldn't have just been

    int main()
       printf("hello");
    }
That's just as unambiguous to parse.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by mikepavone on Thursday August 24, 2023 @07:49PM (#37256036)
Technically, the opening brace is needed in C to support K&R style function declarations which apparently were still legal in C11 at least, but I doubt that's a feature anyone wants to replicate in a new language.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by vore on Thursday August 24, 2023 @07:50PM (#37256044)
Not in the original C, where you had to declare function parameter types like so:

  int foo(x)
    int x;
  {
      return x;
  }
and not in C23 (or GNU C) either, where this is legal (this example is not super useful):

  int foo(int x) [[gnu::aligned]] {
    return x;
  }
Re:Vim creator Bram Moolenaar's forgotten programming langua... by layer8 on Thursday August 24, 2023 @08:10PM (#37256187)
In that case, I would prefer Pascal’s (and Basic’s) “end”, however.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by zarzavat on Thursday August 24, 2023 @08:37PM (#37256388)
Unmatched braces completely mess up text editors, which would need to include a full parser in order to pair-match brackets (it also creates an unresolved tension that will stay with you all day :)
Re:Vim creator Bram Moolenaar's forgotten programming langua... by goku12 on Thursday August 24, 2023 @10:07PM (#37257033)
I was going to say the same. And yes - it causes OCD in 90% of devs out there. But it also feels somewhat wrong for editors to match brackets to infer block hierarchy. What if blocks have some sane rule that we don't know yet (i.e other than bracketed blocks and indented blocks)? Perhaps treesitter is the one-stop solution for that problem.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by cozzyd on Thursday August 24, 2023 @11:15PM (#37257581)
Indeed. Things like di{ probably don't work...
Re:Vim creator Bram Moolenaar's forgotten programming langua... by kgwxd on Friday August 25, 2023 @01:12AM (#37258315)
> :)

That’s a mouth, not a paren :/ I won’t be able to sleep tonight :)) (that’s better

Re:Vim creator Bram Moolenaar's forgotten programming langua... by The_Colonel on Friday August 25, 2023 @04:55AM (#37259562)
Many languages are designed with IDEs in mind and "dumb" text editors are not a concern.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by vidarh on Friday August 25, 2023 @08:28AM (#37260932)
Text editors need fairly complete parsers to match braces anyway. E.g. consider even something as simple as { "}" }. Or {"\"}. The former is reasonably unambiguous, but the latter requires knowing if the escape style of double quoted strings in the given language escapes the second '"' or not. Now try proc {"#{"}"}"} (valid Ruby) vs proc {"{\#{"}"}"} (invalid)
Re:Vim creator Bram Moolenaar's forgotten programming langua... by norir on Thursday August 24, 2023 @10:26PM (#37257209)
I have an even better idea:

  main(): int
    printf "hello"
    0
;)
Re:Vim creator Bram Moolenaar's forgotten programming langua... by lambda_garden on Friday August 25, 2023 @05:04AM (#37259595)
Trouble with that is invoking main and declaring main are too similar. I prefer this:

    let main () =
      printf "hello"
      0
Re:Vim creator Bram Moolenaar's forgotten programming langua... by sltkr on Thursday August 24, 2023 @10:29PM (#37257242)
Why do we put spaces after punctuation in English?It's completely redundant.actually,why even put a capital letter at the beginning of a sentence?it can obviously be inferred.

OK, I'll stop now, but the point is: matching braces provide visual structure that's helpful to read code, even if it's syntactically redundant.

Re:Vim creator Bram Moolenaar's forgotten programming langua... by sph on Friday August 25, 2023 @03:25AM (#37259056)
Prose is not a programming language, isn't it obvious?

One is designed for machines to parse unambiguously, the other has grown organically and chaotically over hundreds of years. Machine parsing has never been a design concern.

Re:Vim creator Bram Moolenaar's forgotten programming langua... by frodowtf on Friday August 25, 2023 @04:31AM (#37259413)
Indentation provides visual structure. Matching braces hardly add value to it.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by Q6T46nT668w6i3m on Friday August 25, 2023 @10:00AM (#37261831)
You identified its purpose: symmetry.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by fferen on Thursday August 24, 2023 @07:50PM (#37256048)
Reminds me of TI-BASIC for the TI-83 graphing calculators... The closing ')' is optional at the end of a line, and omitting it could make your program slightly faster...
Re:Vim creator Bram Moolenaar's forgotten programming langua... by ctenb on Friday August 25, 2023 @01:49AM (#37258535)
One step further would be to omit the second brace too. And we arrived at the Python design choice. I think only omitting the first brace is a middle ground most people find unappealing.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by vidarh on Friday August 25, 2023 @08:32AM (#37260964)
Hence Ruby or Oberon style of "end". Personally I have no intention of ever seriously using a language with significant indentation levels. It's not worth suffering the visual clutter.
Re:Vim creator Bram Moolenaar's forgotten programming langua... by augustk on Friday August 25, 2023 @04:50AM (#37259523)
Niklaus Wirth also removed the BEGIN keyword from control statements in Modula-2 and in Oberon.

Oberon:

  IF a < b THEN
     ...
  END
Pascal:

  IF a < b THEN
  BEGIN
     ...
  END