From: Joseph Jones Date: 2015-12-17T21:06:17-07:00 Subject: [ruby-core:72264] [Ruby trunk - Feature #11761] [Open] `Hash#default_set` and `Hash#default_proc_set` --56738639_2ca88611_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 1, 2015 at 23:34:= 56 MST, sawadatsuyoshi=40gmail.com wrote:Issue =2311761 has been reported= by Tsuyoshi Sawada.----------------------------------------=46eature =23= 11761: =60Hash=23default=5Fset=60 and =60Hash=23default=5Fproc=5Fset=60ht= tps://bugs.ruby-lang.org/issues/11761* Author: Tsuyoshi Sawada* Status: O= pen* Priority: Normal* Assignee: ----------------------------------------= I often want to assign a default value or proc to an existing hash =60h=60= and chain method after it. The way I do it is: Hash.new(default=5Fvalue)= .merge(h)... Hash.new=7Bdefault=5Fproc=5Fvalue=7D.merge(h)...It would be = convenient if I can assign them to a hash directly, and =60Hash=23default= =3D=60 and =60Hash=23default=5Fproc=3D=60 are close to doing that, but th= ey are actually not useful because the return value is not the receiver h= ash: h.default =3D default=5Fvalue; h... h.default=5Fproc =3D proc =7Bdef= ault=5Fproc=5Fvalue=7D; h...I wish there were methods =60Hash=23default=5F= set=60 and =60Hash=23default=5Fproc=5Fset=60 that return the receiver has= h: h.default=5Fset(default=5Fvalue)... h.default=5Fproc=5Fset=7Bdefault=5F= proc=5Fvalue=7D...-- https://bugs.ruby-lang.org/ --56738639_2ca88611_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 1, 2015 at 23:34:56 MST, sawadatsuyoshi=40gmail.com wrote:
Issue =2311761 has been = reported by Tsuyoshi Sawada.

---------------------------------= -------
=46eature =2311761: =60Hash=23default=5Fset=60 and =60Hash=23= default=5Fproc=5Fset=60
https://bugs.ruby-lang.org/issues/11761

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Nor= mal
* Assignee:
----------------------------------------
= I often want to assign a default value or proc to an existing hash =60h=60= and chain method after it. The way I do it is:

Hash.new(d= efault=5Fvalue).merge(h)...
Hash.new=7Bdefault=5Fproc=5Fvalue=7D= .merge(h)...

It would be convenient if I can assign them to a = hash directly, and =60Hash=23default=3D=60 and =60Hash=23default=5Fproc=3D= =60 are close to doing that, but they are actually not useful because the= return value is not the receiver hash:

h.default =3D defa= ult=5Fvalue; h...
h.default=5Fproc =3D proc =7Bdefault=5Fproc=5F= value=7D; h...

I wish there were methods =60Hash=23default=5Fs= et=60 and =60Hash=23default=5Fproc=5Fset=60 that return the receiver hash= :

h.default=5Fset(default=5Fvalue)...
h.default=5F= proc=5Fset=7Bdefault=5Fproc=5Fvalue=7D...




--=
https://bugs.ruby-lang.org/
<= /html> --56738639_2ca88611_16c--