Project

General

Profile

Feature #9778

Bring shortcut methods to Hash

Added by natesymer (Nathaniel Symer) almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Priority:
Normal
Target version:
[ruby-core:62179]

Description

My obsession with easy syntax annoys me when I see Hash#merge does not have a shortcut in the form of a mathematical operation (like - or +).

h_one = { :foo => "bar", :this => "that", :all => "nothing" }
h_two = { :foo => "this", :ruby => "awesome" }

# this isn't as pretty
h_one.merge(h_two)
  =>  { :foo => "this", :this => "that", :all => "nothing", :ruby => "awesome" }

# as this
h_one+h_two
  => { :foo => "this", :this => "that", :all => "nothing", :ruby => "awesome" }`

Why doesn't this exist in Ruby?


Related issues

Is duplicate of Ruby trunk - Feature #6225: Hash#+Rejected03/30/2012Actions

History

Updated by bitsweat (Jeremy Daer) almost 5 years ago

Hash#+ rejected in #6225. Also see #7739 for Hash#|.

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Open to Rejected

Also available in: Atom PDF