From: nobu@... Date: 2018-09-21T08:14:27+00:00 Subject: [ruby-core:89117] [Ruby trunk Feature#5400] Remove flip-flops in 2.0 Issue #5400 has been updated by nobu (Nobuyoshi Nakada). I agree with Eric. It is too annoying to rewrite flip-flop. A patch for flip-flop I found today is: ```diff diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb index d953014952..c05d02358c 100755 --- a/tool/enc-unicode.rb +++ b/tool/enc-unicode.rb @@ -538,6 +538,7 @@ IO.popen(%W[diff -DUSE_UNICODE_AGE_PROPERTIES #{fds[1].path} #{fds[0].path}], "r") {|age| IO.popen(%W[diff -DUSE_UNICODE_PROPERTIES #{fds[2].path} -], "r", in: age) {|f| ansi = false + in_hash = false f.each {|line| if /ANSI-C code produced by gperf/ =~ line ansi = true @@ -545,7 +546,7 @@ line.sub!(/\/\*ANSI\*\//, '1') if ansi line.gsub!(/\(int\)\((?:long|size_t)\)&\(\(struct uniname2ctype_pool_t \*\)0\)->uniname2ctype_pool_(str\d+),\s+/, 'uniname2ctype_offset(\1), ') - if (/^(uniname2ctype_hash) /=~line)..(/^\}/=~line) + if !in_hash ? (in_hash = /^(uniname2ctype_hash) / =~ line) : (in_hash = /^\}/!~line; true) line.sub!(/^( *(?:register\s+)?(.*\S)\s+hval\s*=\s*)(?=len;)/, '\1(\2)') end puts line ``` Does this gain readability? ---------------------------------------- Feature #5400: Remove flip-flops in 2.0 https://bugs.ruby-lang.org/issues/5400#change-74136 * Author: judofyr (Magnus Holm) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: Next Major ---------------------------------------- Nobody knows them. Nobody uses them. Let's just get rid of flip-flops, shall we? -- https://bugs.ruby-lang.org/ Unsubscribe: