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.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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 8476B1F453 for ; Tue, 30 Apr 2019 21:20:11 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 526D4120A9C; Wed, 1 May 2019 06:20:05 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 179CD120A4A for ; Wed, 1 May 2019 06:20:02 +0900 (JST) Received: by filter0030p3mdw1.sendgrid.net with SMTP id filter0030p3mdw1-18511-5CC8BC02-28 2019-04-30 21:20:02.602274319 +0000 UTC m=+435693.900769487 Received: from herokuapp.com (unknown [3.86.82.84]) by ismtpd0011p1iad2.sendgrid.net (SG) with ESMTP id bxz-BLT8SAeCCi_Xkw9jFw for ; Tue, 30 Apr 2019 21:20:02.326 +0000 (UTC) Date: Tue, 30 Apr 2019 21:20:02 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67987 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15745 X-Redmine-Issue-Author: koic X-Redmine-Sender: Eregon 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?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr3CAd5=2FjdZt13vVcI03nK?= =?us-ascii?Q?JuMgvHKM4BFk6XauHTvNaKkTNkZPKKgcOKTCqi9?= =?us-ascii?Q?+zrxh6ve=2Frru2Sl5p9NbIboE=2FYT65a9DVVyfQgV?= =?us-ascii?Q?xSVAZO2j35Cq5VB0kkYpjFTUk9537sosox=2FkpxV?= =?us-ascii?Q?VNqEnOOfBN31Qj=2F82OuNG+azfM=2FB=2FSBBrKg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92504 Subject: [ruby-core:92504] [Ruby trunk Bug#15745] There is no symmetry in the beginless range and the endless range using `Range#inspect` 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15745 has been updated by Eregon (Benoit Daloze). I didn't realize, but Range#to_s and Range#inspect differ by calling #to_s and #inspect on both ends: ``` puts ('a'..'z').to_s # => a..z puts ('a'..'z').inspect # => "a".."z" ``` Following that, for `("a"..)` we'd get `a..` and `"a"..nil`, which I agree is weird for an open end to change representation based on #to_s/#inspect. So in the spirit of most #inspect methods printing what one would write for the Ruby literal I'd be inclined for (2), that is `1..`, `..1` and `nil..nil`. ---------------------------------------- Bug #15745: There is no symmetry in the beginless range and the endless range using `Range#inspect` https://bugs.ruby-lang.org/issues/15745#change-77865 * Author: koic (Koichi ITO) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-04-03 trunk 67423) [x86_64-darwin17] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- The following commit introduces beginless range. https://github.com/ruby/ruby/commit/95f7992b89efd35de6b28ac095c4d3477019c583 ``` % ruby -v ruby 2.7.0dev (2019-04-03 trunk 67423) [x86_64-darwin17] ``` There is no symmetry with endless range when using `Range#inspect` method. ``` (1..).inspect # => "1.." (..5).inspect # => "nil..5" ``` How about unifying whether it represents `nil`? -- https://bugs.ruby-lang.org/