[ruby-dev:49350] [Ruby trunk - Feature #11688] [Feedback] Struct and OpenStruct will be able to chain the Hash#dig Array#dig
From:
nobu@...
Date:
2015-11-16 07:40:40 UTC
List:
ruby-dev #49350
Issue #11688 has been updated by Nobuyoshi Nakada.
Status changed from Open to Feedback
As those two classes were not parts of [Feature #11643], they are not rejected nor discussed.
`Struct#dig` should be at least, IMHO.
> [patch](https://github.com/ruby/ruby/pull/1097)
I feel that an argument of `OpenStruct#dig` should not raise an exception until it is used, as well as `Array` and `Hash`.
~~~ruby
[].dig("foo") #=> no implicit conversion of String into Integer (TypeError)
[].dig(1, "foo") #=> nil
OpenStruct.new.dig(0) #=> undefined method `to_sym' for 0:Fixnum (NoMethodError)
~~~
It may be too strict though.
How do you think?
----------------------------------------
Feature #11688: Struct and OpenStruct will be able to chain the Hash#dig Array#dig
https://bugs.ruby-lang.org/issues/11688#change-54869
* Author: Kenichi Kamiya
* Status: Feedback
* Priority: Normal
* Assignee:
----------------------------------------
Struct and OpenStruct are rejected with #dig? I couldn't get from [Feature #11643]
[patch](https://github.com/ruby/ruby/pull/1097)
--
https://bugs.ruby-lang.org/