Project

General

Profile

Feature #6198

public/protected/private with attr_*

Added by riskwa (riskwa anon) about 7 years ago. Updated 3 months ago.

Status:
Rejected
Priority:
Normal
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

Related to Ruby trunk - Feature #3753: value of def-exprClosed08/28/2010Actions
Has duplicate Ruby trunk - Feature #6470: Make attr_accessor return the list of generated methodOpenActions

History

Updated by mame (Yusuke Endoh) about 7 years ago

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

This issue is strongly related to #3753.

--
Yusuke Endoh mame@tsg.ne.jp

Updated by mame (Yusuke Endoh) over 6 years ago

  • Target version set to 2.6
#3

Updated by naruse (Yui NARUSE) over 1 year ago

  • Target version deleted (2.6)

Updated by matz (Yukihiro Matsumoto) 3 months ago

  • 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.

Also available in: Atom PDF