5 ms·
When did the universe decide braces were so bad? Makes formatting so much easier.
by yeetcode 3y ago
When did the universe decide braces were so bad? Makes formatting so much easier.
- wizerdrobe 3y agoI’m always amazed at coworkers with a 100 WPM typing speed and IntelliSense griping about how hard it is to type.
- jauntywundrkind 3y agoInbound links from HN blocked I think, but Tom Macwright's proclamation that typing is not the problem has long stuck with me. https://macwright.com/2015/01/19/typing-is-not-the-problem https://macwright.com/2015/01/19/typing-is-not-the-problem These optimizations for some perceived ergonomic win almost always make terrible tradeoffs versus using a good well established data format. And especially systems which favor human consumption but create extreme difficulties for machine handling, those are the worst! Yaml being such a non-Context Free Grammar is a huge pain. There's so much state in the parser. It only gets worse from there. Yaml has all kinds of wild crazy capabilities. References, a variety of inline content blocks, and weird ways to invoke stuff?? GitHub yesterday did a code review of Frigate, an enormously popular surveillance video analysis tool that's heavily downloaded, and found, oh yes, a huge glaring yaml bug allowing remote execution, because executing arbitrary code is just built right in to yaml amid 3000 other crazy hacks & who would have known to go look for & disable that capability?! https://news.ycombinator.com/item?id=38630295 https://news.ycombinator.com/item?id=38630295 https://github.blog/2023-12-13-securing-our-home-labs-frigate-code-review/ https://github.blog/2023-12-13-securing-our-home-labs-frigat... Typing is not the problem (even though I see so many people just terrible beyond words at navigating project structures or the command line... Improve! Some day!).
- tbrownaw 3y agoEncoding the same information in both indentation and braces is redundant, and so is a violation of DRY, and so is bad. (Of course the reality is that braces are how you write scoping information and indentation is how you read it, and CQRS is actually a good thing.)
- lucasyvas 3y agoThis is ridiculous. Indentation is a visual concern for humans and braces are a semantic concern for a machine. Code only needs the latter to actually execute. You can prefer them be coupled for taste reasons but they are fundamentally different. Code minification is a practical example where you can save many characters by omitting whitespace. This is like tabs vs spaces. The white spaces crowd prefer the trade offs, and the tab crowd don't. But the white space crowd can't argue the perks of tabs - they exist. disclaimer: Am braces/whitespace camp.
- happymellon 3y agoThe tabs/spaces war was fought because of IDE choices that restricted your ability for sane tab rendering defaults, and simple overriding of tab size. Now that terrible text editors won, I have to watch a 2 Vs 4 space war. If only we could have a character that could represent indentation and people could set the rendering so they can visualise it in their own preferred way. And folks who want to remove braces should be pointed to the Apple certificate snafu.
- pas 3y agoif only whitespace was treated as such visually, and the IDE would serialize to whatever the repository uses, and similarly for YAML-JSON. > Now that terrible text editors won yes. but not all hope is lost, maybe AGI helps/wipes us out!
- happymellon 3y agoConsidering that we lost tabs because some peoples text editors and web browsers rendered them as 8 spaces, and drew the wrong conclusion, I don't have much hope for your plan. However I would be completely on board if we could agree on a formatting configuration file that people could check into a repo for IDEs to pick up.
- turboponyy 3y ago