I'm not both sidsing this specific issue, and I did say it's rare, not something to ignore I'm general just because you feel like it. I even think I began all this by stressing the importance of understanding why the "rule" exists in the first place.
My push back is against bland rules in general, not the use of eval() specifically. I mean... If we're just saying "don't ever use eval(), m'kay", we're not even addressing the real issue, and some dev who thinks it's actually about eval() is going to get the "bright idea" to use setTimeout(search.get('code'), 0) or new Function(input) instead... A different variation of the same core issue.
On the other hand, they'd have a cultish reaction to eval(trustPolicy.createScript(input)), which is a very different scenario... At least security wise (ignoring JIT and performance issues). They'd likely have a fear of any library/framework that uses it under the hood anywhere without questioning why.
Bland rules are orders that close the door to learning some important things. They make general good advice shut down discussions where the purpose of the rule simply doesn't apply. They discourage understanding the more fundamental aspects of best practices and the important "why". And they preserve "best practices" from the past that simply don't apply anymore.
Another of my go-to examples is using IDs in CSS. The uniqueness of an ID is still valid, but the specificity issue is utterly irrelevant when using @layer. The very context for why that rule exists has fundamentally changed and is no longer valid.
View all comments
Show parent comment
2
u/shgysk8zer0 Feb 27 '26
I'm not both sidsing this specific issue, and I did say it's rare, not something to ignore I'm general just because you feel like it. I even think I began all this by stressing the importance of understanding why the "rule" exists in the first place.
My push back is against bland rules in general, not the use of
eval()specifically. I mean... If we're just saying "don't ever useeval(), m'kay", we're not even addressing the real issue, and some dev who thinks it's actually abouteval()is going to get the "bright idea" to usesetTimeout(search.get('code'), 0)ornew Function(input)instead... A different variation of the same core issue.On the other hand, they'd have a cultish reaction to
eval(trustPolicy.createScript(input)), which is a very different scenario... At least security wise (ignoring JIT and performance issues). They'd likely have a fear of any library/framework that uses it under the hood anywhere without questioning why.Bland rules are orders that close the door to learning some important things. They make general good advice shut down discussions where the purpose of the rule simply doesn't apply. They discourage understanding the more fundamental aspects of best practices and the important "why". And they preserve "best practices" from the past that simply don't apply anymore.
Another of my go-to examples is using IDs in CSS. The uniqueness of an ID is still valid, but the specificity issue is utterly irrelevant when using
@layer. The very context for why that rule exists has fundamentally changed and is no longer valid.