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.7 required=3.0 tests=AWL,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_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no 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 30AFE1F461 for ; Sat, 13 Jul 2019 10:31:07 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 90580120A20; Sat, 13 Jul 2019 19:31:00 +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 638BC120A2A for ; Sat, 13 Jul 2019 19:30:58 +0900 (JST) Received: by filter0102p3iad2.sendgrid.net with SMTP id filter0102p3iad2-9684-5D29B2E4-1B 2019-07-13 10:31:00.72181541 +0000 UTC m=+832768.456433473 Received: from herokuapp.com (unknown [34.238.242.141]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id rTlkRgZmR0y8MjOVkLqKlQ for ; Sat, 13 Jul 2019 10:31:00.591 +0000 (UTC) Date: Sat, 13 Jul 2019 10:31:00 +0000 (UTC) From: eregontp@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 69235 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 5781 X-Redmine-Issue-Author: trans X-Redmine-Issue-Assignee: matz 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?KippOI8ZHtTweq7XfQzW93937kJ4QNWwSBuHnaMEcr2hwxNsh0+NyNW0qyguex?= =?us-ascii?Q?9V3Bf6T8rEW5oQdUyewx4QVdUybLpPJJHlUBpCc?= =?us-ascii?Q?xZPmtbeNjwnsB1ss2PrI1ok3qPSLBmMQ73jCIIP?= =?us-ascii?Q?8NFYpAGQOIbzv1iWSLHskVP3TIUhT8govUmp9xa?= =?us-ascii?Q?VU7xS31OEyOeA2NwsPJR1AqyzDXWMXMDmvg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 93739 Subject: [ruby-core:93739] [Ruby master Feature#5781] Query attributes (attribute methods ending in `?` mark) 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 #5781 has been updated by Eregon (Benoit Daloze). FWIW, a long time ago I tried to implement https://bugs.ruby-lang.org/issues/5781#note-7 in MRI but it turned out to be not so easy and I gave up. ---------------------------------------- Feature #5781: Query attributes (attribute methods ending in `?` mark) https://bugs.ruby-lang.org/issues/5781#change-79376 * Author: trans (Thomas Sawyer) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- Pretty sure this has come up before, but I'd like to revisit b/c I don't understand why it isn't allowed. Sometimes I define "query" attributes, and in those cases I'd like the reader method to end in a `?` mark. Currently I have to do: # @attribute def foo? @foo end or, if I don't mind a shadowing bare method, attr :foo alias_method :foo?, :foo So why not just allow: attr :foo? Currently this causes an error. But why? It just seems like a waste of potentially cleaner code. -- https://bugs.ruby-lang.org/