Project

General

Profile

Actions

Feature #8164

open

Public/Private

Added by Anonymous over 11 years ago. Updated almost 4 years ago.

Status:
Assigned
Target version:
-
[ruby-core:53727]

Description

Would it be a good idea to compress these 4 methods to 2 methods?

public - Can set both instance and class methods to public by passing
them in as symbol
private - Can set both instance and class methods to private by passing
them in as symbol

and enable them to be called at top of class? Is this a good idea? It would
clean up Module# and encourage use of these two
as methods rather than keywords

Actions #1

Updated by drbrain (Eric Hodel) over 11 years ago

  • Category set to core

=begin

If private_class_method is removed, how will the class method foo be set to private here:

class C
def self.foo() end
def foo() end

private :foo

end

=end

Updated by EdwardCh (Edward Chen) over 11 years ago

"Stuff" the private() method to take the explicit options.
A possible solution would be:
private (:instance => [], :class => [:foo])

In this way, although it adds a bit of complexity to the private and public methods, we would have reduced the method count of Module by 2 and simplified a class view => I can see all the public, private methods at a glance.

Updated by drbrain (Eric Hodel) over 11 years ago

  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 3.0

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

Class methods and instance methods are different things.
I don't see advantages of this proposal.

Actions #5

Updated by naruse (Yui NARUSE) almost 4 years ago

  • Target version deleted (3.0)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0