ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: eregontp@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:90038] [Ruby trunk Feature#11689] Add methods allow us to get visibility from Method and UnboundMethod object.
Date: Sat, 24 Nov 2018 15:50:57 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-75147.20181124155056.1eed4980fb2009e2@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11689.20151115045331@ruby-lang.org

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/

  parent reply	other threads:[~2018-11-24 15:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11689.20151115045331@ruby-lang.org>
2015-11-15  4:53 ` [ruby-core:71490] [Ruby trunk - Feature #11689] [Open] Add methods allow us to get visibility from Method and UnboundMethod object spiketeika
2015-11-15  6:51 ` [ruby-core:71491] [Ruby trunk - Feature #11689] " shibata.hiroshi
2015-11-15 10:08 ` [ruby-core:71493] " spiketeika
2018-10-22 21:43 ` [ruby-core:89514] [Ruby trunk Feature#11689] " Mike
2018-11-04 23:56 ` [ruby-core:89708] " spiketeika
2018-11-05  0:40 ` [ruby-core:89709] " Mike
2018-11-05 15:43 ` [ruby-core:89711] " shevegen
2018-11-22  8:00 ` [ruby-core:89958] " matz
2018-11-22 17:51 ` [ruby-core:89982] " Mike
2018-11-24  6:43 ` [ruby-core:90024] " mame
2018-11-24 12:40 ` [ruby-core:90036] " eregontp
2018-11-24 13:10 ` [ruby-core:90037] " mame
2018-11-24 15:50 ` eregontp [this message]
2018-11-26  4:42 ` [ruby-core:90067] " duerst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-75147.20181124155056.1eed4980fb2009e2@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).