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 4A2F31F453 for ; Tue, 30 Apr 2019 16:42:00 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C66E3120A8A; Wed, 1 May 2019 01:41:55 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 001EA120A8A for ; Wed, 1 May 2019 01:41:53 +0900 (JST) Received: by filter0032p3las1.sendgrid.net with SMTP id filter0032p3las1-25793-5CC87AD2-1F 2019-04-30 16:41:54.382268477 +0000 UTC m=+418466.767707733 Received: from herokuapp.com (unknown [3.86.82.84]) by ismtpd0044p1mdw1.sendgrid.net (SG) with ESMTP id va7ejV6JS3aJkB6jiV7HTQ for ; Tue, 30 Apr 2019 16:41:54.271 +0000 (UTC) Date: Tue, 30 Apr 2019 16:41:54 +0000 (UTC) From: zverok.offline@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67984 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15745 X-Redmine-Issue-Author: koic X-Redmine-Sender: zverok 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?3be0g8093pjUjT94eiCA64csFDBI=2FmHQTWm54P5gda5KUwiU+6zbAHDKT97IW+?= =?us-ascii?Q?6xbRsv9nCGjatDTkK1KT2Kpbb9TUghOMFFkbDPk?= =?us-ascii?Q?Xm733f+KlDLJafhJc3ikNAOi3HUl+CMVxJcNGNh?= =?us-ascii?Q?RPU=2Fg8hrWrHu4OOBG7hPLnDCipFpN1Tc1eVPqUa?= =?us-ascii?Q?yfs42ZJ3THljLuJOfvG7qfu9YTSX43Yq2xw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92501 Subject: [ruby-core:92501] [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 zverok (Victor Shepelev). My reasoning is semi-open ranges are valuable feature, and by `inspect` we should suggest to users their "naturalness", not "it is just a quick hack, look". Explicit rendering of `nil` is *underlining* some kind of "hackiness" ("it is just a syntactic sugar for `1..nil` underneath"). I believe it is an important new language feature, and it should be represented adequately. `1..nil`/`nil..1` is not adequate, because it is hard to read: "range from 1 to nothing"? (it doesn't read as "range without end", which it is). So I'd say that: 1. `p (1..) # => (1..)`, and that's the only adequate representation 2. `p (..1) # => (..1)`, and that's the only adequate representation 3. How `nil..nil` is represented is not THAT important, because it is the rarest and less useful case; I don't think even `(..)` is that bad. It looks kinda weird, but it still is what it is: "range (designated by `..`) with neither end nor beginning". The point is, there could be a discussion about (3), and it is only marginally important; but not about (1) and (2). In this line of reasoning, "Make `(..1)` looking weird for consistency with `(nil..nil)`" is less than desirable. ---------------------------------------- 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-77862 * 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/