From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.1 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 76364211B5 for ; Fri, 11 Jan 2019 19:45:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 15EF0121860; Sat, 12 Jan 2019 04:45:23 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id D0E31121758 for ; Sat, 12 Jan 2019 04:45:19 +0900 (JST) Received: by filter0076p3iad2.sendgrid.net with SMTP id filter0076p3iad2-8414-5C38F24D-18 2019-01-11 19:45:17.376458241 +0000 UTC m=+327485.276630055 Received: from herokuapp.com (ec2-54-81-68-147.compute-1.amazonaws.com [54.81.68.147]) by ismtpd0045p1mdw1.sendgrid.net (SG) with ESMTP id oNFQUZ41SzixyBsUuPJ6Zg for ; Fri, 11 Jan 2019 19:45:17.215 +0000 (UTC) Date: Fri, 11 Jan 2019 19:45:17 +0000 (UTC) From: alissonbruno.sa@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66462 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15526 X-Redmine-Issue-Author: alissonbruno.sa X-Redmine-Sender: alissonbruno.sa X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5+5hQ+iySDS7Vk0BzpNQ2vLUE0+OJ1HAsBaT dJfZtizkUT86IVLT+GdJzQe6F9cDZakwRvtmItemkNjPmBk3gyTzIvfzXGIQ7lvHVQK6sEjpr527U7 ZxWy8ZXjs3qIo8k20HT21x6ziGN3ocNz108l0I52F2oprbYeL9VlCT51Yw== X-ML-Name: ruby-core X-Mail-Count: 91028 Subject: [ruby-core:91028] [Ruby trunk Feature#15526] New way to destruct an object hash X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15526 has been reported by alissonbruno.sa (Alisson Santos). ---------------------------------------- Feature #15526: New way to destruct an object hash https://bugs.ruby-lang.org/issues/15526 * Author: alissonbruno.sa (Alisson Santos) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- JavaScript has a nice a neat way to destruct objects. ~~~ javascript const person = { name: "John Doe", age: 33 }; const { name, age } = person; ~~~ Erlang has a similar way to destruct a tuple: ~~~ erlang Person = {"John Doe", 33} {Name, Age} = Person ~~~ I think it's very handy and would be nice if we have something similar in Ruby. ~~~ ruby config = { host: 'localhost', port: 3000 } { host, port } = config ~~~ I know Ruby has Hash#values_at, but I think this way it's more readable and understandable What do you guys think? -- https://bugs.ruby-lang.org/