Issue #6373 has been updated by trans (Thomas Sawyer).


Does it really need a slide? Does someone at developers meeting want to bring it up? It's such a simple thing. It's probably a one line addition to code to make `self` available as public method. Only question is name, which seems to me, why have different public name than private name? But if necessary for public/private names to differ, everyone seems okay with #itself.


----------------------------------------
Feature #6373: public #self
https://bugs.ruby-lang.org/issues/6373#change-27726

Author: trans (Thomas Sawyer)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0


=begin
This was recently suggested to me as an extension:

  class Object
    # An identity method that provides access to an object's 'self'.
    #
    # Example:
    #   [1,2,3,4,5,1,2,2,3].group_by(&:identity)
    #   #=> {1=>[1, 1], 2=>[2, 2, 2], 3=>[3, 3], 4=>[4], 5=>[5]}
    #
    def identity
      self
    end
  end

First, is such a method commonly useful enough to warrant existence?

Second, it makes me wonder if #self should be a public method in general.
=end


-- 
http://bugs.ruby-lang.org/