r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
Does Syntax Matter?
https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63
Upvotes
r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
View all comments
Show parent comment
6
u/munificent Feb 22 '26
For:
We've considered something like that for Dart. (Currently, we have the equivalent of
if letwith pattern matching but no equivalent ofguard let.)I like that it avoids adding another control flow construct. But on the other hand, it makes the scoping very subtle and hard to scan. Consider:
These two
print(a)statements refer to different variables. If you're scanning those two functions, you have to notice that there iselseblock, and that it exits, in order to understand the scoping of the rest of the surrounding block.If you change the contents of the
elseblock to no longer exit, then you've implicitly changed the scope of any variables declared in the if`'s pattern.I suspect that's just too subtle to want to hang variable scoping off of.