[#84280] [Ruby trunk Bug#14181] hangs or deadlocks from waitpid, threads, and trapping SIGCHLD — nobu@...
Issue #14181 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/12/15
[#84398] [Ruby trunk Bug#14220] WEBrick changes - failures on MSWIN, MinGW — Greg.mpls@...
Issue #14220 has been reported by MSP-Greg (Greg L).
3 messages
2017/12/22
[#84472] Re: [ruby-dev:50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — Eric Wong <normalperson@...>
Shouldn't English posts be on ruby-core instead of ruby-dev?
3 messages
2017/12/26
[ruby-core:84017] [Ruby trunk Feature#12753] Useful operator to check bit-flag is true or false
From:
aycabta@...
Date:
2017-12-01 00:31:13 UTC
List:
ruby-core #84017
Issue #12753 has been updated by aycabta (Code Ahss). phluid61 (Matthew Kerwin) wrote: > It introduces a strange paradox, though: > > ~~~ruby > a.allbits? 0 #→ true > a.nobits? 0 #→ true > ~~~ I discussed it with @watson1978 (Shizuo Fujita). We guess the behavior is not strange. The allbits? means "The receiver checks that all standing bits of the argument don't sit on itself". ~~~ruby a.allbits? 0 #→ true ~~~ In this case, "all standing bits of the argument don't sit on the receiver " because "all standing bits of argument" is nothing. So it returns true. I think this is correct. If I have to choose a word, it's reasonable specification. ~~~ruby a.nobits? 0 #→ true ~~~ I think this is correct in the same way. ---------------------------------------- Feature #12753: Useful operator to check bit-flag is true or false https://bugs.ruby-lang.org/issues/12753#change-68098 * Author: tagomoris (Satoshi TAGOMORI) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Ruby's 0 is truthy value. It's useful for many cases, but it's confusing and I made many bugs when I'm writing code to handle binary data, because my thought is almost same with one to write C code in such situation. ```ruby n = get_integer_value if n & 0b10100000 # code for the case when flag is true else # never comes here :( end ``` IMO it's very useful to have methods for such use-cases, like `#and?` and `#xor?` (`#or?` looks not so useful... I can't imagine the use case of this operator, but it's better to have for consistency). ```ruby n = get_integer_value case when n.and?(0b10000000) # negative signed char when n.and?(0b01110000) # large positive else # small positive end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>