[ruby-core:93978] [Ruby master Feature#15896] Symbol#+

From: ko1@...
Date: 2019-07-29 07:44:58 UTC
List: ruby-core #93978
Issue #15896 has been updated by ko1 (Koichi Sasada).

Status changed from Open to Rejected

Ut seems difficult to introduce.
Please reopen it with your opinion if it should be discussed more.

----------------------------------------
Feature #15896: Symbol#+
https://bugs.ruby-lang.org/issues/15896#change-80171

* Author: zeus (Zeus 81)
* Status: Rejected
* 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next