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=-4.1 required=3.0 tests=BAYES_00, 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 E1A1C211B4 for ; Mon, 14 Jan 2019 15:46:00 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 5CEA51190B6; Tue, 15 Jan 2019 00:45:57 +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 233CA1190B0 for ; Tue, 15 Jan 2019 00:45:55 +0900 (JST) Received: by filter0126p3las1.sendgrid.net with SMTP id filter0126p3las1-10070-5C3CAEB0-58 2019-01-14 15:45:52.985135632 +0000 UTC m=+573565.279020221 Received: from herokuapp.com (ec2-54-197-82-100.compute-1.amazonaws.com [54.197.82.100]) by ismtpd0027p1iad2.sendgrid.net (SG) with ESMTP id KWIKFaPSSzGAoSH7I34y4w for ; Mon, 14 Jan 2019 15:45:52.933 +0000 (UTC) Date: Mon, 14 Jan 2019 15:45:53 +0000 (UTC) From: elia@schito.me To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66532 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15526 X-Redmine-Issue-Author: alissonbruno.sa X-Redmine-Sender: elia 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS4bJYjqYwKTDki0GaTpUSANWqIoJ0ZRx+70Pd i2xWuu7oMlvvWhI22TSsgdGGXAZS+ZwWuu1cqOCAAW7JHDjAZLNy3Fcn10lPXQ1RzTsoTzTWBvRkHg bTcqFLRhYEXkuCewjkPXIeKdLMfETpOokA7f X-ML-Name: ruby-core X-Mail-Count: 91083 Subject: [ruby-core:91083] [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 updated by elia (Elia Schito). Related/duplicate https://bugs.ruby-lang.org/issues/11758 ---------------------------------------- Feature #15526: New way to destruct an object hash https://bugs.ruby-lang.org/issues/15526#change-76311 * 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/