From: eregontp@... Date: 2019-06-03T17:26:07+00:00 Subject: [ruby-core:92940] [Ruby trunk Feature#15896] Symbol#+ Issue #15896 has been updated by Eregon (Benoit Daloze). FWIW, there is no need for a cache, since Symbol are interned (and an explicit cache would leak memory). I think Symbols are generally different than Strings, so #+ feels a bit out of place for me here. Can you show a realistic use case? ---------------------------------------- Feature #15896: Symbol#+ https://bugs.ruby-lang.org/issues/15896#change-78316 * Author: zeus (Zeus 81) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I've made this today ``` ruby class Symbol @@cache_add = Hash.new {|h1,k1| h1[k1] = Hash.new {|h2,k2| h2[k2] = :"#{k1}#{k2}"}} def +(s) @@cache_add[self][s] end end :abc + :def # => :abcdef ``` I thought it was so awesome it should become standard. -- https://bugs.ruby-lang.org/ Unsubscribe: