From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 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.1 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 077481F516 for ; Sat, 30 Jun 2018 23:43:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C591B12095E; Sun, 1 Jul 2018 08:43:22 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id C1D9C12095E for ; Sun, 1 Jul 2018 08:43:18 +0900 (JST) Received: by filter0003p3iad2.sendgrid.net with SMTP id filter0003p3iad2-13113-5B381592-32 2018-06-30 23:43:15.006891475 +0000 UTC Received: from herokuapp.com (ec2-54-144-125-194.compute-1.amazonaws.com [54.144.125.194]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id I72k8UH3TxSpBaeRESev0w for ; Sat, 30 Jun 2018 23:43:14.933 +0000 (UTC) Date: Sat, 30 Jun 2018 23:43:15 +0000 (UTC) From: samuel@oriontransfer.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 63118 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14844 X-Redmine-Issue-Author: rmosolgo X-Redmine-Sender: ioquatix 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7MPWclGo62GIYSTtnjPkPGhmIwpMHntVGg7m 5PyQ6ih+SSxrlkWZkah0KQWmDwHlnTc/SUui5U/tEooCBE03OyTthZIli5kmbp7jMRwlGrt3XVft0M 1M6/JoF/sl5y2dMI7Cm/e2pj5fe/132kVaV6pNPpLodNZoY1m2AdxMBs/w== X-ML-Name: ruby-core X-Mail-Count: 87727 Subject: [ruby-core:87727] [Ruby trunk Feature#14844] Future of RubyVM::AST? 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 #14844 has been updated by ioquatix (Samuel Williams). Rather than create a new issue, I want to comment here, as I've also been using the new `RubyVM::AST` to compute code coverage of templates (think ERB templates). In the past, the existing `coverage.so` was not capable to parse a string, so being able to compute it by hand using `RubyVM::AST` is a great boon. When using `RubyVM::AST::Node#type`, the return value is a string. I wondered if it would make more sense to return a symbol. Rather than a string like `"NODE_SCOPE"`, perhaps return a symbol like `:scope`. It would make it easier and perhaps more efficient to traverse the AST, and it seems more Ruby-like. ---------------------------------------- Feature #14844: Future of RubyVM::AST? https://bugs.ruby-lang.org/issues/14844#change-72748 * Author: rmosolgo (Robert Mosolgo) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Hi! Thanks for all your great work on the Ruby language. I saw the new RubyVM::AST module in 2.6.0-preview2 and I quickly went to try it out. I'd love to have a well-documented, user-friendly way to parse and manipulate Ruby code using the Ruby standard library, so I'm pretty excited to try it out. (I've been trying to learn Ripper recently, too: https://ripper-preview.herokuapp.com/, https://rmosolgo.github.io/ripper_events/ .) Based on my exploration, I opened a small PR on GitHub with some documentation: https://github.com/ruby/ruby/pull/1888 I'm curious though, are there future plans for this module? For example, we might: - Add more details about each node (for example, we could expose the names of identifiers and operators through the node classes) - Document each node type I see there is a lot more information in the C structures that we could expose, and I'm interested to help out if it's valuable. What do you think? -- https://bugs.ruby-lang.org/