On 17/11/2015 12:18 AM, <6ftdan / gmail.com> wrote:
>
> Issue #11690 has been updated by Daniel P. Clark.
>
>
> I'm not sure the opts[*] is a good idea.  You have have current splat
behavior with multiple assignment.
>
> ~~~ruby
> a, *, c = [1,2,3,4,5]
> a
> # => 1
> c
> # => 5
> ~~~
>
> And the opts[*] is unclear about what it is and what it expects.  It
could be a Proc.
>
> ~~~ruby
> prc = proc {|b,c,d| b+c+d }
> # if [*] were implemented
> a, prc[*], c = [1,2,3,4,5]
> ~~~
>

Good point. I won't suggest anything to do with hash-splatting **  ;)

> As far as I know **Hash** is the only core object with an **update**
method.  And in other cases where **update** is used, such as in Rails'
ActiveRecord, a Hash is the expected input.  So when the **update** method
is called it is generally understood to be expecting a **Hash** object.
>
> Implementing [*] would be much more work that simply implementing
`Hash#update=`
>
> I was thinking about suggesting `Hash#merge!=` as well but Ruby syntax
does not allow the equals sign after and exclamation point.  So I have
chosen to only suggest `Hash#update=`
>
> ~~~ruby
> class Hash
>   def update=(h)
>     update(h)
>   end
> end
> ~~~
>

It's still very strange to think of 'update' as a property of a hash
object. Without some kind of new syntactic construct, with its own clear
semantics, this seems like a hack and doesn't feel right in the core (to
me; others may disagree.)