[#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 u=
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.
[#92893] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— Al Snow <jasnow@...>
2019/05/30
[ruby-core:92644] [Ruby trunk Feature#15848] Silence warning when conditional assignments are wrapped in parentheses
From:
mail@...
Date:
2019-05-14 09:08:13 UTC
List:
ruby-core #92644
Issue #15848 has been updated by sos4nt (Stefan Sch=FC=DFler). sawa (Tsuyoshi Sawada) wrote: > Why do the parentheses indicate that assignment is intended, and not comp= arison? It's a convention used in C compilers. ---------------------------------------- Feature #15848: Silence warning when conditional assignments are wrapped in= parentheses https://bugs.ruby-lang.org/issues/15848#change-78007 * Author: sos4nt (Stefan Sch=FC=DFler) * Status: Open * Priority: Normal * Assignee: = * Target version: = ---------------------------------------- Sometime it's convenient to have an assignment in an `if`-condition. The Ru= by documentation even contains an example showing this *"most common use of= side-effect"* practice: http://ruby-doc.org/core-2.6.3/doc/syntax/control_expressions_rdoc.html#lab= el-if+Expression ```ruby if a =3D object.some_value # do something to a end ``` Running that code however results in a warning: > warning: found =3D in conditional, should be =3D=3D It's very unfortunate that the Ruby docs contain example code that the pars= er complains about. And it's unfortunate that we can't make use of conditio= nal assignments without getting warnings or turning off warnings. I propose an obvious change to the current warning mechanism: **Don't show the warning when the assignment is wrapped in parentheses.** ```ruby if a =3D object.some_value # warning end if (a =3D object.some_value) # no warning end ``` This is the way RoboCop already works and it's also a known workaround from= other languages. It would also allow the documentation to contain a warning-free example. -- = https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>