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.3 required=3.0 tests=AWL,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 0967C211BB for ; Thu, 27 Dec 2018 22:10:35 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4CDBE120AB2; Fri, 28 Dec 2018 07:10:32 +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 79E77120AB2 for ; Fri, 28 Dec 2018 07:10:29 +0900 (JST) Received: by filter0062p3mdw1.sendgrid.net with SMTP id filter0062p3mdw1-20777-5C254DD3-29 2018-12-27 22:10:27.555771683 +0000 UTC m=+605580.240143665 Received: from herokuapp.com (ec2-54-205-240-145.compute-1.amazonaws.com [54.205.240.145]) by ismtpd0047p1mdw1.sendgrid.net (SG) with ESMTP id JzYsH8LBR123_YV0EVFZig Thu, 27 Dec 2018 22:10:27.457 +0000 (UTC) Date: Thu, 27 Dec 2018 22:10:28 +0000 (UTC) From: eregontp@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 66174 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15287 X-Redmine-Issue-Author: ko1 X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: Eregon 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS5c5pKTETuJmWLCt+9D75DcOhEulQZ+TFpg0L 5oEzDmQv98kEQrEQ0PTQRya1DBeaqquhfhb1rQhfoS2wPdy0tO9PNBCr3rlKWOfv7u8fziK/xcJ/sK k+eVvHdTNoFXkS4RjW5ltVlWLHOpHSSIowb4njHxAbE3CLYmjLgl/Ujf3A== X-ML-Name: ruby-core X-Mail-Count: 90754 Subject: [ruby-core:90754] [Ruby trunk Feature#15287] New TracePoint events to support loading features 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 #15287 has been updated by Eregon (Benoit Daloze). I wonder, what purpose do you envision for `instruction_sequence`? It is of course MRI-specific (as documented), so I'm not sure how one would use it on other Ruby implementations. > I named `eval_script` because we can not get source code other than *eval methods (not by `require` and `load`). That would be a very useful feature though, and could maybe be created lazily when the method is called. It seems somewhat similar to https://github.com/jruby/jruby/issues/5206#issue-328885424, which also wants to be able to modify the source on the fly. ---------------------------------------- Feature #15287: New TracePoint events to support loading features https://bugs.ruby-lang.org/issues/15287#change-75927 * Author: ko1 (Koichi Sasada) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: 2.6 ---------------------------------------- # Abstract I propose the following new TracePoint events: * `loaded` (invoked after `require`/`load`) * `method_added` (invoked after method definition) # Background Sometimes we need to hook loading iseq. For example, checking loading files and so on. Also we want to know what kind of methods are defined. For both purpose, we can use some hook methods such as `Module#method_added` and so on. However, defining methods we can override this features. So that if we have two tools/libraries using this feature, they can be conflicted. # Proposal Introduce new TracePoint events: * `loaded` (invoked after `require`/`load`) * `method_added` (invoked after method definition) Also the following methods can be added: * Active only `loaded` event: * `TracePoint#loaded_feature` returns feature name. * `TracePoint#loaded_iseq` returns `RubyVM::InstructionSequence` object (MRI only, internal feature) # Optional proposal Add `class_added` alias name for `class` event. -- https://bugs.ruby-lang.org/