5 ms·
I’d argue that every language is loaded full of foot guns. If you’re encountering those foot guns on a regular basis, it’s an issue with the author. That said,
by SlightlyLeftPad 3y ago
I’d argue that every language is loaded full of foot guns. If you’re encountering those foot guns on a regular basis, it’s an issue with the author.
That said, what can help drastically here are well-defined best practices and conventions built into the language which, admittedly, bash really doesn’t have.
- _a_a_a_ 3y agoCan you point to 3 python foot guns, for instance?
- s1dev 3y agoI’m generally in agreement with the anti-bash camp, but I can name about that many :) - Mutating default arguments to functions, so subsequent calls have different behavior - Somewhat particular rules around creating references vs copies - Things that look like lambda captures but aren’t quite
- _a_a_a_ 3y agoTouche!
- sanderjd 3y agoYep, every language has footguns and other kinds of quirks, but I contend that the "footguns per character" ratio in shell is unusually high. (It is not unique in having a high ratio though; other popular languages, like c++ for instance, also have this issue.)
- eitland 3y agoThe worst (level of nastyness * usage) offenders all probably have a reason for being popular despite their flaws: - Bash: installed everywhere you want to work (yes, who actually wants to work on Windows ;-) - C/C++: when speed/size matters there was no alternative except Assembly until recently - Javascript: until recently this was the most sane option for client side code on the web (Active X and Java applets existed yes but managed to be even worse.) - PHP: Low cost hosting, Function-As-A-Service way before that became popular, shared nothing architecture, instant reload for local development bliss
- sanderjd 3y agoCouldn't agree more.
- bonzini 3y ago- string vs. list "in" ('a' in 'a' is True, but 'a' in ['a'] is also True) - cannot know which object attributes are private or public (and some classes use settable properties so you can't say "just don't set any attributes on non-dataclass objects")