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.
So it might look silly, but there is no deep reason it couldn't have just been
That's just as unambiguous to parse.