From: matz@... Date: 2017-11-29T06:54:10+00:00 Subject: [ruby-core:83946] [Ruby trunk Feature#14132] Module#attr{|_reader|_writer} should be public Issue #14132 has been updated by matz (Yukihiro Matsumoto). OK, I understand. They will be public in 2.5 Matz. ---------------------------------------- Feature #14132: Module#attr{|_reader|_writer} should be public https://bugs.ruby-lang.org/issues/14132#change-68007 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- Modules and classes can be reopened and changed (unless frozen). This is used in many meta programming techniques. Currently, `attr_accessor`, `attr_writer` and `attr_reader` are private, so we need to either do a `class_eval`, reopen the class somehow, or resort to `:send` As I previously stated in #6539, I feel that the use of `send` should be reserved for incorrect usage of actually private methods that might change of interface or aren't meant to be called this way (e.g. `respond_to_missing?`) Matz has stated before that "class/module operations should be done in the scope.". Nevertheless, common usage shows that there are many cases where Rubyists prefer using a single line for this, even if it means having to call `send`. Here are 15k+ examples of `send :attr_accessor` in the wild: https://github.com/search?utf8=%E2%9C%93&q=language%3Aruby+%22send+%3Aattr_accessor%22&type=Code 15k+ examples of `send :attr_writer` in the wild: https://github.com/search?utf8=%E2%9C%93&q=language%3Aruby+%22send+%3Aattr_writer%22&type=Code 15k+ examples of `send :attr_reader` in the wild: https://github.com/search?utf8=%E2%9C%93&q=language%3Aruby+%22send+%3Aattr_reader%22&type=Code Please make consider making `:attr`, `:attr_accessor`, `:attr_writer` and `:attr_reader` public. -- https://bugs.ruby-lang.org/ Unsubscribe: