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=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_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 59BFD1F97E for ; Sat, 24 Nov 2018 15:51:07 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 10675121626; Sun, 25 Nov 2018 00:51:03 +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 AB4AD1215F1 for ; Sun, 25 Nov 2018 00:51:00 +0900 (JST) Received: by filter0100p3las1.sendgrid.net with SMTP id filter0100p3las1-24680-5BF97361-8 2018-11-24 15:50:57.4466354 +0000 UTC m=+761012.939057176 Received: from herokuapp.com (ec2-54-91-133-138.compute-1.amazonaws.com [54.91.133.138]) by ismtpd0015p1iad2.sendgrid.net (SG) with ESMTP id kawZp0KjSBO1H3s0MxSt8w Sat, 24 Nov 2018 15:50:57.341 +0000 (UTC) Date: Sat, 24 Nov 2018 15:50:57 +0000 (UTC) From: eregontp@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65434 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11689 X-Redmine-Issue-Author: yui-knk 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7ShKXR9AwCWi/cc+QwIZp9iVBdQ4TD4BFWga aXAUv/Gky0bUJJMr2hclarl6QG2EVGCpsMcU1W2cdAyPKvKk3V7IEp+FM+CEaGIstFuw1DU/yMzpGM 0oGzzy4iIfXKMkYc5YAP2SuYMRAJTwQRVOQP+kJ3yOV4+Lh9GlfsehvqQQ== X-ML-Name: ruby-core X-Mail-Count: 90038 Subject: [ruby-core:90038] [Ruby trunk Feature#11689] Add methods allow us to get visibility from Method and UnboundMethod object. 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 #11689 has been updated by Eregon (Benoit Daloze). mame (Yusuke Endoh) wrote: > FYI: The reason why matz does not like the term "visibility", is because the method attribute is not a visibility. In fact, all methods are visible in Ruby. Instead, the method attribute restricts how and where it can be called. We briefly discussed another name candidate at the meeting, but we couldn't find a good name of the concept. Then matz chose the three methods (public?, etc.) because we can avoid deciding the name. Thanks for the information :) Right, the visibility does not affect how to call the method reflectively (which is done with Method#call), but reflects the visibility in the context of normal calls. To be honest, I expect very few people to be confused by this. I think it's clear it means the definition time visibility. Metaprogramming methods in general ignore visibility (or enforce public with #public_send), so a visibility for how to call the Method object wouldn't make sense anyway. > Instead, the method attribute restricts how and where it can be called. > We briefly discussed another name candidate at the meeting, but we couldn't find a good name of the concept. Visibility is the standard term to talk about public/protected/private and restrictions of how and where a method can be called, in all languages I know. I think no other term makes more sense than visibility, and it is a well-known concept in programming languages. Maybe in other natural languages this is confusing? I think in English it's as clear as it can be for an established concept. > In fact, all methods are visible in Ruby. I'm not sure what you mean here. But one could say "method m in class A is not visible to instances of class B" and that would apply to Ruby if m is private. ---------------------------------------- Feature #11689: Add methods allow us to get visibility from Method and UnboundMethod object. https://bugs.ruby-lang.org/issues/11689#change-75147 * Author: yui-knk (Kaneko Yuichiro) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Add `Method#visibility` and `UnboundMethod#visibility` for getting visibility from Method and UnboundMethod object. In GitHub https://github.com/ruby/ruby/pull/1098. ---Files-------------------------------- 0001-Add-Method-visibility-and-UnboundMethod-visibility.patch (3.11 KB) -- https://bugs.ruby-lang.org/