[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92863] [Ruby trunk Bug#15880] Wrong precedence of the if modifier in pattern matching
From:
ibylich@...
Date:
2019-05-27 13:51:53 UTC
List:
ruby-core #92863
Issue #15880 has been reported by ibylich (Ilya Bylich).
----------------------------------------
Bug #15880: Wrong precedence of the if modifier in pattern matching
https://bugs.ruby-lang.org/issues/15880
* Author: ibylich (Ilya Bylich)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.7.0dev (2019-05-20 trunk ab0f2deab1) [x86_64-darwin18]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
When "If" is used as an "If modifier" it runs before the expression that it wraps:
``` ruby
=> puts 1 if (puts 2; true)
2
1
```
However, when it's used in the pattern matching destructuring runs first:
``` ruby
class A
def deconstruct
puts 'deconstruct called'
[1]
end
end
p case A.new
in A[1] if (puts 'if check'; true)
'yes'
else
'no'
end
# prints
# deconstruct called
# if check
# "yes"
```
I personally think that it's very confusing as it doesn't reflect the code. I assumed it to not run destructuring if the check returns `false` (especially because destructuring is allowed to have side-effects)
--
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>