From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 3D85B1F454 for ; Fri, 1 Nov 2019 16:05:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id E2DA5120B06; Sat, 2 Nov 2019 01:05:14 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 10941120B03 for ; Sat, 2 Nov 2019 01:05:11 +0900 (JST) Received: by filter0031p3iad2.sendgrid.net with SMTP id filter0031p3iad2-2056-5DBC57B9-6 2019-11-01 16:05:13.066141401 +0000 UTC m=+61946.296690502 Received: from herokuapp.com (unknown [3.89.31.191]) by ismtpd0052p1iad1.sendgrid.net (SG) with ESMTP id Fr_9GbeqQVS5EDymSyJ3ig for ; Fri, 01 Nov 2019 16:05:12.998 +0000 (UTC) Date: Fri, 01 Nov 2019 16:05:13 +0000 (UTC) From: rafael@franca.dev Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71229 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13083 X-Redmine-Issue-Author: kachick X-Redmine-Sender: rafaelfranca X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?hQn=2F9kUoGv6yO+lV=2FCHhz6wIp5O+pZ2DinLsqEwYyKLLCzyOxDK=2Fxa5ar5rNrb?= =?us-ascii?Q?hUIQOgHViT2FgGNXKAjelfGF9i2+I8lruz7BHfe?= =?us-ascii?Q?lo30nUuIZn+2acE4DVyHKxMlH0NkHalfuNG7WOd?= =?us-ascii?Q?QxfGuyH9pQN7t9F9gP9pmcssMnJJEGiq6Xm9mQO?= =?us-ascii?Q?0mLcT9EWjDJeMMYIT6pibMqMH9RncC6vTEw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95636 Subject: [ruby-core:95636] [Ruby master Feature#13083] {String|Symbol}#match{?} with nil returns falsy as Regexp#match{?} X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #13083 has been updated by rafaelfranca (Rafael Fran=E7a). The detailed situation. Rails and other libraries and codebases rely on `/regex/.match?(nil)` to re= turn false. This change is making that method to raise an error in that sit= uation. Changing this behavior on Ruby 2.7 means that applications will break becau= se of this change. This change also have dubious value. While it makes things consistent now i= t require the callers to do one more check. Code that before was: /foo/.match?(some_variable) Need to become: some_variable && /foo/.match?(some_variable) or /foo/.match?(some_variable) unless some_variable If you ask me, I believe this change is good, but it doesn't require a brea= king change. We can deprecate the old behavior and then in a next version r= emove it. The codebases can change their code, of course, but so they can change for = any breaking change in Ruby. If we are being careful to not introduce break= ing changes in Ruby, this change should also falls in that category in my o= pinion. If we are ok with this breaking change, why not with others like fr= ozen string as default? Both change will require changes to codebases and b= oth changes have dubious value. ---------------------------------------- Feature #13083: {String|Symbol}#match{?} with nil returns falsy as Regexp#m= atch{?} https://bugs.ruby-lang.org/issues/13083#change-82424 * Author: kachick (Kenichi Kamiya) * Status: Closed * Priority: Normal * Assignee: = * Target version: = ---------------------------------------- Just for consistency * patch: https://github.com/ruby/ruby/pull/1506 * spec: https://github.com/ruby/spec/pull/380 Currently behaves as ( ruby --version: ruby 2.5.0dev (2016-12-28 trunk 5722= 8) [x86_64-darwin16] ) ~~~ ruby 'string'.__send__(:=3D~, nil) #=3D> nil 'string'.match(nil) #=3D> TypeError: wrong argument type nil (expec= ted Regexp) 'string'.match?(nil) #=3D> TypeError: wrong argument type nil (expec= ted Regexp) :symbol.__send__(:=3D~, nil) #=3D> nil :symbol.match(nil) #=3D> TypeError: wrong argument type nil (expec= ted Regexp) :symbol.match?(nil) #=3D> TypeError: wrong argument type nil (expec= ted Regexp) /regex/.__send__(:=3D~, nil) #=3D> nil /regex/.match(nil) #=3D> nil /regex/.match?(nil) #=3D> false ~~~ Expected to ~~~ruby 'string'.__send__(:=3D~, nil) #=3D> nil 'string'.match(nil) #=3D> nil 'string'.match?(nil) #=3D> false :symbol.__send__(:=3D~, nil) #=3D> nil :symbol.match(nil) #=3D> nil :symbol.match?(nil) #=3D> false /regex/.__send__(:=3D~, nil) #=3D> nil /regex/.match(nil) #=3D> nil /regex/.match?(nil) #=3D> false ~~~ -- = https://bugs.ruby-lang.org/ Unsubscribe: