5 ms·
The visual difference between a ! and an l is not that great, send_email if !user.suspended? or send_email if luser.suspended? The latter could easi
by jjgreen 4y ago
The visual difference between a ! and an l is not that great,
send_email if !user.suspended?
or
send_email if luser.suspended?
The latter could easily be an aggressive dev sending abusive emails to users they dislike enough to call lusers, at first glance at least ...
- SanjayMehta 4y agoBrought back memories of alt.sysadmin.recovery.
- quietbritishjim 4y agoPerhaps a Python style spelt-out `not` for boolean negation would have been a better solution for this than `unless` in deep retrospect? send_email if not user_suspended?
- jjgreen 4y agoRuby has "not", but the precedence rules between "not" and "!" differ
- quietbritishjim 4y agoWell I really showed myself up as commenting on a topic that I know nothing about! :-) But that's actually ideal in this context, a really low precedence operator is exactly what you want because you can swap `unless` for `if not` without worring about extra parentheses: send_email if not user_suspended? || user_opt_out?
- greenpeas 4y agoI wouldn't use this. Relying on tricky operator precedence can trip up your readers. It's better to just wrap everything in parentheses. I also use parentheses when mixing && and ||, even though their precedence relationship is (probably) more widely known. I generally avoid `not`, `and`, `or` keywords.
- hnbad 4y agoSadly `¬` never caught on. But I suppose being visually similar to `-` isn't much better.
- Joker_vD 4y agoThe "logical negation" sign used to have the vertical line as long as "|", so e.g. "¬A" looked more like "‾|A" but fully vertically aligned with the letter. Sadly, this glyph fell out of usage in fonts in favour of "minus with cedilla/descender".
- jjgreen 4y agoI'd always understood it came from Frege's Begriffsschrift, a small descender from a horizontal line (part of a larger diagram), so like a short wide T, then lost its right arm later. Would you have some examples? (a quick google images shows nothing like that ...)
- Joker_vD 4y agoIt was definitely a thing in Soviet works on mathematical/symbolic logic. But here's an example from Curry [0]. As I said, it was mostly a stylistic choice. [0] https://www.google.ru/books/edition/Foundations_of_Mathematical_Logic/27dkTJFrLZIC?hl=ru&gbpv=1&dq=symbolic%20logic&pg=PA4&printsec=frontcover https://www.google.ru/books/edition/Foundations_of_Mathemati...
- tsimionescu 4y agoIf it's not a shift+<something> key on a popular keyboard layout, it's not going to gain widespread adoption in programming.
- housecarpenter 4y ago¬ is shift+` on the most common UK keyboard layout, but yeah, it would probably need to be popular in America.
- forkerenok 4y agoFunny, when I read your point, I was sure and ready counter with an argument that code editors must highlight symbols and unary operators differently (colours, maybe spacing as well). But I just checked this on a couple of Ruby and JS highlighters and they are actually not! :scream: