Project

General

Profile

Actions

Feature #21858

open

`Kernel#Hash` considers `to_h` too

Feature #21858: `Kernel#Hash` considers `to_h` too

Added by ccmywish (Aoran Zeng) 21 days ago. Updated 10 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:124660]

Description

  1. Kernel#Integer uses to_int first and to_i second
  2. Kernel#Array uses to_ary first and to_a second
  3. Kernel#Hash only uses to_hash

I don't quite understand why there is a need for differential treatment here.

I admit that maybe the only benefit of considering to_h secondly is that it enables multiple APIs to maintain consistency.

Actions

Also available in: PDF Atom