▲ | tialaramex 7 days ago | |||||||||||||||||||
This is a footgun. A language should strive not to add footguns. Every footgun you provide, somebody is going to blow their foot off with it, so that's a high price. If your language is popular it might be a lot of somebodies. The opposite behaviour (we have a constant regular expression, we re-use it often but the tooling doesn't realise and so it's created each time we mention it) is not a footgun, it results in poor performance, and so you might want (especially in some managed languages) to just magically optimise this case, but if not you won't cause mysterious bugs. An expert, asked "Why is this slow?" can just fix it - you have to supply basic tools for that, but this flag is not a sensible tool. | ||||||||||||||||||||
▲ | elif 7 days ago | parent | next [-] | |||||||||||||||||||
Is it really though? There are tons of characters you can add to a regex that have difficult if not impossible to mentally comprehend impacts on the potential matches. That's why you need 100 test cases for every 10 characters you write in a regex. Regex itself could all be a footgun by this standard. No one in the history of no one has ever thought "why dont I just add a random character to my regex I don't need or understand" that's just boogie man level irrational fear if you think this has any bearing on the ease of use of ruby. | ||||||||||||||||||||
| ||||||||||||||||||||
▲ | roughly 7 days ago | parent | prev | next [-] | |||||||||||||||||||
One of my favorites was Python’s datetime.time() object evaluating to True for every value except exact midnight, which is the sort of thing that makes fine sense when you think about the underlying implementation but is absolutely going to take a toe off of someone. My favorite part about that one was it got to go through the full feature deprecation cycle before removal because several people argued in the bug thread about it that they were relying on that behavior in their systems. | ||||||||||||||||||||
▲ | gpvos 7 days ago | parent | prev | next [-] | |||||||||||||||||||
In the 1990s, with the processing power of the time, /o was a reasonable compromise. The language later evolved to do the smart thing you describe, but you can't just remove features. A warning would be in order though. | ||||||||||||||||||||
▲ | emmelaich 7 days ago | parent | prev [-] | |||||||||||||||||||
Sometimes you want to blow your foot off. |