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=-2.9 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 F341A1F453 for ; Mon, 29 Apr 2019 10:34:44 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C8B351209F6; Mon, 29 Apr 2019 19:34:39 +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 5D5DE120969 for ; Mon, 29 Apr 2019 19:34:37 +0900 (JST) Received: by filter0083p3mdw1.sendgrid.net with SMTP id filter0083p3mdw1-1400-5CC6D33B-E 2019-04-29 10:34:35.329088125 +0000 UTC m=+309176.251612448 Received: from herokuapp.com (unknown [54.161.168.50]) by ismtpd0036p1mdw1.sendgrid.net (SG) with ESMTP id 2CSSnue-Q42WsiUIq3OEiA for ; Mon, 29 Apr 2019 10:34:35.318 +0000 (UTC) Date: Mon, 29 Apr 2019 10:34:35 +0000 (UTC) From: zverok.offline@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67957 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=2FmHQTWm54P5gda49UumSOt12f5mBmPzKxq?= =?us-ascii?Q?jOXMFwYSGrRQQ2yGKtt8LQ3ACnyIK03RTn9u48B?= =?us-ascii?Q?qk4q=2FXgSETBz4X0hf4vxzDMU4acjObLo55SYZjv?= =?us-ascii?Q?Tyrth7v0sFEzOEcLFGFIR=2FdR3=2FD5+Uj=2F7wP7za6?= =?us-ascii?Q?YWBN1QCG5cdRiwak0Nb9VHM6s7Jxy5EXYZA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92474 Subject: [ruby-core:92474] [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). > I think that an endless range will be much more commonly used than a beginless one because an endless range has many use cases but a beginless range has only one use case (DSL-like usage). Thus, I liked to make an endless one more useful and implemented the current behavior. That's very confusing. The only thing where the beginless range is less justified than endless is **indexing of arrays**, which I believe is a very small share of Range usage. Other are: * case * grep * storing ranges in constants * indeed DSLs (many kinds of them) * clamp (if the [ticket](https://bugs.ruby-lang.org/issues/14784) would be accepted, which I believe it should) Generally, the beginless range is an exactly equally powerful and useful concept as an endless one, and the thing that "for array indexing, the beginless range is less useful" should be considered a style detail, not the reason for deliberately "less mindful" implementation. ---------------------------------------- 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-77821 * 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/