5 ms·
.include? isn't really a predicate, as predicates are typically unary. Rather, it's the 'member of' relational operator written in the wrong direction. Since
by efaref 11y ago
.include? isn't really a predicate, as predicates are typically unary. Rather, it's the 'member of' relational operator written in the wrong direction. Since we don't have '∈' in ascii, the author is proposing using the word 'in' instead.
I do disagree with the author on one point: 'not in' should also be a valid operator, representing '∉'.
But I don't use Ruby; I mostly use Python, which has these operators.
- bhaak 11y agoIt's not a problem using non ASCII method names in Ruby: https://gist.github.com/bhaak/91428b9aee88ac50dd1d https://gist.github.com/bhaak/91428b9aee88ac50dd1d I can't think of any modern programming language that isn't unicode aware even though for the standard library methods, there are very good reasons not to use them (I know, Perl 6 does but even in this case there are ASCII fallbacks). You should also have very good reasons to put methods on the root class of your class hierarchy.
- vidarh 11y ago> It's not a problem using non ASCII method names in Ruby Making it easy for people to type them, on the other hand...
- bhaak 11y ago> Making it easy for people to type them, on the other hand... That's a problem of the code editors people are using. ;-) I'm often surprised with how dysfunctional editors people are programming. For example if all editors would show tabs and spaces (or whitespace in general) in a reasonable way, we wouldn't have had that much pointless discussion about the correct indentation whitespace character.