From: "vjoel (Joel VanderWerf)" Date: 2013-06-25T07:46:20+09:00 Subject: [ruby-core:55640] [ruby-trunk - Feature #6373] public #self Issue #6373 has been updated by vjoel (Joel VanderWerf). =begin Another argument against #identity: it is used by several libraries for something completely different. For example, in narray: >> NMatrix.float(2,2).identity => NMatrixfloat2,2: [ [ 1.0, 0.0 ], [ 0.0, 1.0 ] ] It's also used in celluloid-zmq: s1 = PubSocket.new s1.identity = "publisher-A" I vote for "itself" or "self", which are unlikely to be defined anywhere with some fundamentally different meaning. =end ---------------------------------------- Feature #6373: public #self https://bugs.ruby-lang.org/issues/6373#change-40124 Author: trans (SYSTEM ERROR) Status: Feedback Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =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/