Project

General

Profile

Actions

Feature #6198

closed

public/protected/private with attr_*

Feature #6198: public/protected/private with attr_*

Added by riskwa (riskwa anon) over 13 years ago. Updated almost 7 years ago.

Status:
Rejected
Target version:
-
[ruby-core:43589]

Description

I'd like to set visibility like this:

class X
protected attr_accessor :x, :y
end

attached patch(for 1.9.3-p125) is sample implementation (it seems to pass test-all)

  • make attr_* to return array of method-symbols which attr_* concerns (e.g. [:x, :x=, :y, :y=])
  • make public/protected/private to accept array of symbols

Files

0000-attr-with-visibility.patch (8.32 KB) 0000-attr-with-visibility.patch riskwa (riskwa anon), 03/25/2012 02:58 AM

Related issues 2 (0 open2 closed)

Related to Ruby - Feature #3753: value of def-exprClosedusa (Usaku NAKAMURA)Actions
Has duplicate Ruby - Feature #6470: Make attr_accessor return the list of generated methodClosedmatz (Yukihiro Matsumoto)Actions

Updated by mame (Yusuke Endoh) over 13 years ago Actions #1 [ruby-core:43935]

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

This issue is strongly related to #3753.

--
Yusuke Endoh

Updated by mame (Yusuke Endoh) almost 13 years ago Actions #2 [ruby-core:49728]

  • Target version set to 2.6

Updated by naruse (Yui NARUSE) almost 8 years ago Actions #3

  • Target version deleted (2.6)

Updated by matz (Yukihiro Matsumoto) almost 7 years ago Actions #4 [ruby-core:90981]

  • Status changed from Assigned to Rejected

There's no use for private attr_reader, attr_writer, etc.
And protected is not encouraged enough for new features. So I reject this.

Matz.

Actions

Also available in: PDF Atom