From: Yehuda Katz Date: 2011-12-02T07:53:02+09:00 Subject: [ruby-core:41439] Re: [ruby-trunk - Feature #5695] CoffeeScript "is" and "isnt" keywords --0016368340b6e43c0b04b30fb60f Content-Type: text/plain; charset=ISO-8859-1 I'm not in favor of this proposal, but I don't think it would break these cases, because they are not of the form foo is bar. It would, however, break this case: def foo; end def is(*); end foo is 1 Yehuda Katz (ph) 718.877.1325 On Thu, Dec 1, 2011 at 2:07 PM, Eric Hodel wrote: > > Issue #5695 has been updated by Eric Hodel. > > > =begin > This would break compatibility with RubyGems: > > $ egrep '\bis' lib/rubygems/package/tar_input.rb | grep -v '#' > is = new io, security_policy > yield is > is.close if is > is = zipped_stream entry > Gem::Package::TarReader.new is do |inner| > is.close if is > is = StringIO.new(dis) > is = StringIO.new(zis.inflate(entry.read)) > > =end > > ---------------------------------------- > Feature #5695: CoffeeScript "is" and "isnt" keywords > http://redmine.ruby-lang.org/issues/5695 > > Author: Suraj Kurapati > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > > > Hello, > > Please add "is" and "isnt" keywords, which behave like the "==" and "!=" > operators respectively, to Ruby. These keywords come from the CoffeeScript > language. They are useful to prevent accidental assignment (forgetting a > "=" in "==") and they preserve reading order, unlike inverted "if 5 == x" > expressions known as "Yoda conditionals". > > Thanks for your consideration. > > > -- > http://redmine.ruby-lang.org > > --0016368340b6e43c0b04b30fb60f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm not in favor of this proposal, but I don't think it would break= these cases, because they are not of the form foo is bar. It would, howeve= r, break this case:

=A0 def foo; end
=A0 def i= s(*); end

=A0 foo is 1

Yehuda Ka= tz
(ph) 718.877.1325


On Thu, Dec 1, 2011 at 2:07 PM, Eric Hod= el <drbrain@se= gment7.net> wrote:

Issue #5695 has been updated by Eric Hodel.


=3Dbegin
This would break compatibility with RubyGems:

=A0$ egrep '\bis' lib/rubygems/package/tar_input.rb | grep -v '= ;#'
=A0 =A0 =A0is =3D new io, security_policy
=A0 =A0 =A0yield is
=A0 =A0 =A0is.close if is
=A0 =A0 =A0 =A0is =3D zipped_stream entry
=A0 =A0 =A0 =A0 =A0Gem::Package::TarReader.new is do |inner|
=A0 =A0 =A0 =A0 =A0is.close if is
=A0 =A0 =A0 =A0is =3D StringIO.new(dis)
=A0 =A0 =A0 =A0is =3D StringIO.new(zis.inflate(entry.read))

=3Dend

----------------------------------------
Feature #5695: CoffeeScript "is" and "isnt" keywords http= ://redmine.ruby-lang.org/issues/5695

Author: Suraj Kurapati
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Hello,

Please add "is" and "isnt" keywords, which behave like = the "=3D=3D" and "!=3D" operators respectively, to Ruby= . =A0These keywords come from the CoffeeScript language. =A0They are useful= to prevent accidental assignment (forgetting a "=3D" in "= =3D=3D") and they preserve reading order, unlike inverted "if 5 = =3D=3D x" expressions known as "Yoda conditionals".

Thanks for your consideration.


--
http://redmine.r= uby-lang.org


--0016368340b6e43c0b04b30fb60f--