Project

General

Profile

Actions

Bug #11035

closed

Calling #hash method: inconsistency between dynamic and static symbols

Added by ko1 (Koichi Sasada) about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

There is an inconsistency between static symbols and dynamic symbols.

class Symbol
  def hash
    raise
  end
end

h = {}
h[:foo] = 1          #=> no problem
h['bar'.to_sym] = 2  #=> unhandled exception

I think it should be same behavior.
My favorite is skip calling #hash for all Symbol objects.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0