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
3
u/gingerbill Feb 22 '26
In the case of just
guard condition else, I don't think it's worth it, but from what I understand,guard letexisted to solve the problem of heavily nestedif let:If that was the solution to that problem, I think they should have not merged the concepts of
unlessandguard lettogether and have a separate construct. Something like Perl's use ofunlessas an operator:The scope of the
letis the same and not "guarded" making it look ambiguous when scanning.In a way, it's similar to Odin's
or_returntoo but that is a lot more restricted since I don't want to have statements within expressions. But for Swift, they don't seem to care that much, so this approach seems better to me.