From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on starla X-Spam-Level: X-Spam-Status: No, score=-1.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=N/zWA9ET; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=A4QJg0ad; dkim-atps=neutral Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 60D901F646 for ; Thu, 28 Aug 2025 22:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1756421875; bh=/QABptY1beNOuOxeddW4+n6nZ0dMi0R5plWqRs+e6gI=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=N/zWA9ET17spPngTBisnzJTvWHPyHffwiLNK7MyAPto1OFUGEbQcqbzKnY0vEaPWc 5pJG0KiI8ePEQyxPbfywDaHAb3qn+Zb2wBjXWlgLclGrci+WZvASeKqtYdX6k4cy3o jFSRCwCGgW8Gj6Hfq4Opip19AVP8t0kKrB5epVQE= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id EF58A48D28 for ; Thu, 28 Aug 2025 22:57:55 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=A4QJg0ad; dkim-atps=neutral Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 5AE6848B99 for ; Thu, 28 Aug 2025 22:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=date:from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:date:from:subject:to; s=s1; bh=33AT5B8i59HZePYN2OmwXbgoOR5DgTqxu7WivfbMN7c=; b=A4QJg0ad9vbDqSCdWw/7ZPS7Q4+MnB5ttpbvzcTnEqvSf/GJ55dLeZIODIYfVYYcrzWT HPu0pKLZWFj6+Vnk5GqsT2QAyNJc8eIl7GOcj3RYeWAeHDhtrrJ3XaWXC4+Z1lsEy9Vw3b DG3RuO/OK8xaHaMrS8twfxRLFVnNWeeg6EtlK+oYUxMlL3mAZlpBM+8doKQgVNQsQInWar NaZdXKW5GS3145KD/C6s9TbAv16ZW9BqNoxgCKp/Kfkk/BtKR/VNLyg/oUQoJcDKxA3UBD 4lEhEv3pHFwdtSuQV6dVjvWOfvGFnvEiToBh+9QasuQLGc8GuRLtc0hYHcUspcdQ== Received: by recvd-canary-7787d4fc79-kg2p5 with SMTP id recvd-canary-7787d4fc79-kg2p5-1-68B0DEB3-1B 2025-08-28 22:56:51.992079977 +0000 UTC m=+7429709.587506737 Received: from herokuapp.com (unknown) by geopod-ismtpd-16 (SG) with ESMTP id CmIiTElnSgeudZUH9x4gbA for ; Thu, 28 Aug 2025 22:56:51.919 +0000 (UTC) Date: Thu, 28 Aug 2025 22:56:52 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 21555 X-Redmine-Issue-Author: shan X-Redmine-Issue-Priority: Normal X-Redmine-Sender: shan 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-Redmine-MailingListIntegration-Message-Ids: 99920 X-SG-EID: =?us-ascii?Q?u001=2E9fGRHcaur0AuvitC=2F1zdJ7W0yF4MIWkxScnW56JP3D1Ru6E8cp4fwU50h?= =?us-ascii?Q?hG=2FIY2Xn1m8ku39wNL1Ycq7qVKPg2at8MlH86pC?= =?us-ascii?Q?QD+axk8pzTWPSYTQuIfv9jhbMEg2hVFHPzfOV77?= =?us-ascii?Q?ALP1w4XZo5RW2GckpXhAB7f90EYLs7d0=2F2lG87z?= =?us-ascii?Q?fv7Z5+JqSkyAGlxN5OjMdAmOX7++mkYWi1M00Fn?= =?us-ascii?Q?7fyM5y78uMzTS=2FyGt2sXunBJAnhztIMJTcq7G7R?= =?us-ascii?Q?H57C5Cz=2FLmcLq2+KQ1Aaqo6cyw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: KJAG6JARZBFALHMCYLWNLMYZEDCOEV4W X-Message-ID-Hash: KJAG6JARZBFALHMCYLWNLMYZEDCOEV4W X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:123113] [Ruby Feature#21555] Add support for predicate attribute reader names List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "shan (Shannon Skipper) via ruby-core" Cc: "shan (Shannon Skipper)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #21555 has been reported by shan (Shannon Skipper). ---------------------------------------- Feature #21555: Add support for predicate attribute reader names https://bugs.ruby-lang.org/issues/21555 * Author: shan (Shannon Skipper) * Status: Open ---------------------------------------- After manually aliasing predicate methods many times, I wanted to propose letting `attr_reader` take predicate method names that correspond to instance variables of the base name without a trailing question mark. https://github.com/ruby/ruby/pull/14391 If the base name method doesn't already exist, a predicate name defines a base name method attribute reader to alias then undefines the base name. For example, this creates an `enabled?` method that reads `@enabled`: ```ruby attr_reader :enabled? ``` This feature is only supported for `attr_reader` and `attr`, not `attr_writer` or `attr_accessor`, since setter methods cannot have question marks. Example: ```ruby class Example attr_reader :valid?, :meaning def initialize @valid = [true, false].sample @meaning = 42 end end Example.new.valid? #=> true ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/