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.1 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 C254720248 for ; Thu, 28 Feb 2019 11:47:38 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8A65B121D53; Thu, 28 Feb 2019 20:47:34 +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 9427F120B87 for ; Thu, 28 Feb 2019 20:47:31 +0900 (JST) Received: by filter0104p3las1.sendgrid.net with SMTP id filter0104p3las1-23119-5C77CA51-12 2019-02-28 11:47:29.423731159 +0000 UTC m=+364968.724041873 Received: from herokuapp.com (ec2-35-153-142-167.compute-1.amazonaws.com [35.153.142.167]) by ismtpd0029p1mdw1.sendgrid.net (SG) with ESMTP id ojvftB1dQwygd_69y4n8nA for ; Thu, 28 Feb 2019 11:47:29.357 +0000 (UTC) Date: Thu, 28 Feb 2019 11:47:30 +0000 (UTC) From: sawadatsuyoshi@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67090 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15627 X-Redmine-Issue-Author: sawa X-Redmine-Sender: sawa 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7EoMybDbKj9ku5gO4L1YV9Sv7+X6KWTcvmXz Ky+H6+3vcYUnMqdfOZSPz/+fbS2RhtFj6AK0Zawl49WGdQVFEeuTRhJEZ6Gi7AyPSPWPiOaTtoeAxK dxTKShvuNTfiYrm2dHOKoJ4XhaDudAb5+0VdyqAJlxbcmV4Zie4jTyt6oA== X-ML-Name: ruby-core X-Mail-Count: 91640 Subject: [ruby-core:91640] [Ruby trunk Bug#15627] Appearance of custom singleton classes 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 #15627 has been reported by sawa (Tsuyoshi Sawada). ---------------------------------------- Bug #15627: Appearance of custom singleton classes https://bugs.ruby-lang.org/issues/15627 * Author: sawa (Tsuyoshi Sawada) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- When I have a singleton class `AClass` of an instance `a` of a custom class `A`, ```ruby class A; end a = A.new AClass = a.singleton_class ``` i) even though the singleton class of `nil`, `false`, and `true` are referred to by their assigned constant names, the singleton class `AClass` of `a` is not: ```ruby nil.singleton_class #=> NilClass false.singleton_class #=> FalseClass true.singleton_class #=> TrueClass a.singleton_class #=> #> ``` ii) even though the singleton class of `nil`, `false`, and `true` appear as their class, the singleton class `AClass` of `a` does not: ```ruby nil.class #=> NilClass false.class #=> FalseClass true.class #=> TrueClass a.class #=> A ``` This contrast between `nil`, `false`, and `true` on the one hand and `a` on the other is confusing. I am actually not sure if this is intended behaviour It may be related to * https://bugs.ruby-lang.org/issues/15608 * https://bugs.ruby-lang.org/issues/14895 I expect `AClass` to behave the same as with `NilClass`, `FalseClass`, and `TrueClass`. I expect: ```ruby a.singleton_class #=> AClass a.class #=> AClass ``` If the current behaviour is intended, I would like this to become a feature request. -- https://bugs.ruby-lang.org/