9 ms·
Thus far I have seen screenshots of it flagging the phrases "I would like to buy 4 watermelons" and "I just broke my 8 year old laptop". Regardless of your opin
by lainga 5y ago
Thus far I have seen screenshots of it flagging the phrases "I would like to buy 4 watermelons" and "I just broke my 8 year old laptop". Regardless of your opinion on the ethics of this feature it seems to need a little polish.
- klyrs 5y agoYeah, that would get flagged in human code review, too. Way too many magic numbers
- crooked-v 5y agoOne number is 'too many'?
- klyrs 5y agoI've gotten into way too many fights over this, and my bitter sarcasm is leaking here. I actually like numbers in code. But I've literally been told that distance = ((x1-x0)**2 + (y1-y0)**2)**.5 has "magic numbers" and that's a "code smell"
- ectopod 5y agoRaising to the power of .5 rather than using the sqrt function does whiff a bit. Even better, use hypot. https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/math/hypot https://developer.mozilla.org/en-US/docs/web/javascript/refe... https://docs.python.org/3/library/math.html https://docs.python.org/3/library/math.html
- klyrs 5y agoYup, hypot is better on performance grounds, if you assume I'm using doubles. But is it as readable as my snippet?
- Noumenon72 5y agoHow could it not be? It has a name that says what it's doing, while yours is more punctuation than text. To "read" yours I have to just skim over it and mentally assign "according to the variable name, that hodgepodge means 'distance'... I hope". I have a BS in math, so obviously I'm familiar with the math notation, but I code like an English major.
- klyrs 5y agoIf the function was named "hypotenuse" then it would be unambiguously more readable. But since the function is considerably older than the modern zealotry surrounding code readability, it's this weird 5-letter word that most people aren't familiar with. Contrast that to the Pythagorean theorem, which folks are exposed to in elementary/middle school.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- seoaeu 5y agoYeah, not to mention tons of possible variations of that line that you might not notice at a glace but would completely change the output.
- klyrs 5y agoYeah, my bad for not radiation-hardening my code https://github.com/mame/radiation-hardened-quine https://github.com/mame/radiation-hardened-quine
- seoaeu 5y agoI was thinking more in line with http://www.underhanded-c.org http://www.underhanded-c.org, but that was also an interesting read
- deleted 5y ago[deleted]
- echelon 5y agoI was once told in code review that using XOR was "too low level" for Ruby code. This was by a person that sprinkled lazy backfilling behavior throughout the codebase, created magic method_missing dispatches against polymorphic ActiveRecord relationships, and exposed the database as a service through a RESTful DSL that allowed arbitrary method dispatch. I'm glad I spend most of my time in statically typed, math and binary-friendly codebases now.
- deleted 5y ago[deleted]
- cjhveal 5y agoReminds me of the 2005 conversational simulation game, Facade[0], in which any mention of the word "melon" would be met with being immediately kicked out of your host's dinner party. [0]: https://www.playablstudios.com/facade https://www.playablstudios.com/facade
- inopinatus 5y agoc.f also the “Scunthorpe problem”. https://en.wikipedia.org/wiki/Scunthorpe_problem https://en.wikipedia.org/wiki/Scunthorpe_problem
- josefx 5y agoA working text content filter that doesn't randomly flag seemingly innocent input is something I wouldn't expect to see within my lifetime.