Log in Sign up
2 Matching Annotations
  1. Mar 2021
  2. bugs.ruby-lang.org bugs.ruby-lang.org
    Feature #11747: "bury" feature, similar to 'dig' but opposite - Ruby master - Ruby Issue Tracking System
    2
    1. TylerRick 30 Mar 2021
      in Public
      A one-liner alternative for hash-only cases can be implemented using Enumerable#reduce: root = {} [:a, :b, :c].reduce(root){@1[@2]||={}}[:d] = 'E' # root => {:a=>{:b=>{:c=>{:d=>"E"}}}}
      one-liners solving/handling specific case instead of the general case because general solution would be too hard/complex objects/hashes
    2. TylerRick 30 Mar 2021
      in Public
      I think the issues/problems specified in the comments are not present with a Hash-only implementation. :) I would be supportive of re-considering this feature just for use with a Hash, where I believe 80% of the real-life use cases would (and do) exist. I have encountered this need before in the wild, but not with Arrays.
      I agree can't support everything / all cases simple solution objects/hashes Ruby: core solving/handling the general case solving/handling specific case instead of the general case because general solution would be too hard/complex
    Visit annotations in context

    Tags

    • can't support everything / all cases
    • one-liners
    • solving/handling specific case instead of the general case because general solution would be too hard/complex
    • I agree
    • objects/hashes
    • Ruby: core
    • simple solution
    • solving/handling the general case

    Annotators

    • TylerRick

    URL

    bugs.ruby-lang.org/issues/11747
Share:
Group. Only group members will be able to view this annotation.
Only me. No one else will be able to view this annotation.
Hypothes.is
  • About
  • Blog
  • Bioscience
  • Education
  • Jobs
  • Help
  • Contact
  • Terms of Service
  • Privacy Policy