by User3456335 · 3y ago · 0 comments
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.
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. 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;
}That’s a mouth, not a paren :/ I won’t be able to sleep tonight :)) (that’s better
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.
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.
main(): int
printf "hello"
0
;) let main () =
printf "hello"
0Oberon:
IF a < b THEN
...
END
Pascal: IF a < b THEN
BEGIN
...
END