From: michael.telford@...
Date: 2019-08-19T08:22:53+00:00
Subject: [ruby-core:94429] [Ruby master Bug#16111] Combining default positional and keyword arguments is resulting in a `to_hash` method call

Issue #16111 has been updated by mtelford (Michael Telford).


Ok, thanks for the reply. That now makes more sense. I understand why the last positional argument is type-checked but surely trying to convert it using `param#to_hash` is a step too far? Doing so basically means that the last positional argument cannot `respond_to? :to_hash`, as in my case. It's not ideal as my problem still exists. 

----------------------------------------
Bug #16111: Combining default positional and keyword arguments is resulting in a `to_hash` method call
https://bugs.ruby-lang.org/issues/16111#change-80853

* Author: mtelford (Michael Telford)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.3
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Combining default positional and keyword arguments is resulting in a `to_hash` method call when I don't believe it should be. It's affecting some code I am writing. The full details of the behaviour I'm describing can be seen in the attached script.

I would like to know why the method `to_hash` is being called (only in certain circumstances) and if this is a bug to be fixed or desired behaviour (and why?).

Thank in advance!

---Files--------------------------------
ruby-bug.rb (1.44 KB)


-- 
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>