Issue #17472 has been updated by sawa (Tsuyoshi Sawada).


I am surprised and am sad that so many of the core developers are positive on this.

I am clearly against this feature, but being very generous, I think there can be two logically sane possibilities:

1. Ruby keeps the String-Symbol class distinction, and keeps them as well when used as hash keys.
2. Ruby dispenses the String-Symbol class distinction, and as a consequence, the distinction is lost in hash keys.

The third case below, which is proposed here, does not make sense.

3. Ruby keeps the String-Symbol class distinction, but dispenses with them when used as certain types of hash keys.


----------------------------------------
Feature #17472: HashWithIndifferentAccess like Hash extension
https://bugs.ruby-lang.org/issues/17472#change-91236

* Author: naruse (Yui NARUSE)
* Status: Open
* Priority: Normal
* Target version: 3.1
----------------------------------------
Rails has [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html), which is widely used in Rails to handle Request, Session, ActionView's form construction, ActiveRecord's DB communication, and so on. It receives String or Symbol and normalize them to fetch the value. But it is implemented with Ruby. If we provide C implementation of that, Rails will gain the performance improvement.

summary of previous discussion: https://github.com/rails/rails/pull/40182#issuecomment-687607812



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