ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: pavel.evst@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:73901] [CommonRuby Feature#12093] Eval InstructionSequence with binding
Date: Sat, 20 Feb 2016 12:00:21 +0000	[thread overview]
Message-ID: <redmine.issue-12093.20160220120020.b6f91fab2c2327ba@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-12093.20160220120020@ruby-lang.org

Issue #12093 has been reported by Pavel Evstigneev.

----------------------------------------
Feature #12093: Eval InstructionSequence with binding
https://bugs.ruby-lang.org/issues/12093

* Author: Pavel Evstigneev
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Implementing this feature can boost template engine performance

Currently Kernel#eval can accept binding argument, so code running with eval will have access to local variables and current instance. This feature used by template languages

ERB: https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L887
Erubis: Can't find code on github, but it uses instance_eval or Kernel#eval
Haml: https://github.com/haml/haml/blob/master/lib/haml/engine.rb#L115

My proposal is to make RubyVM::InstructionSequence#eval to recieve binding argument. So it can be used for caching templates. As I see from ERB and Haml, cached template is stored as ruby code string, every time when we render template that string (ruby code) is evaluated, internally ruby will parse it into RubyVM::InstructionSequence and then evaluate.

Before I try to implement it myself in ruby, but could not. Lack of experience with C https://github.com/Paxa/ruby/commit/f5b602b6d9eada9675a4c002c9a5a79129df73a6 (not working)



-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2016-02-20 11:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-12093.20160220120020@ruby-lang.org>
2016-02-20 12:00 ` pavel.evst [this message]
2016-02-21  4:53 ` [ruby-core:73906] [Ruby trunk Feature#12093] Eval InstructionSequence with binding nobu
2016-02-22  8:06 ` [ruby-core:73918] " nobu
2016-03-03  5:10 ` [ruby-core:74103] " shyouhei
2016-03-04 14:44 ` [ruby-core:74140] " nobu
2016-09-29  5:41 ` [ruby-core:77452] " nobu
2019-07-22 16:51 ` [ruby-core:93868] [Ruby master " dale.hamel
2019-07-23  4:35 ` [ruby-core:93877] " dale.hamel
2019-07-23 15:01 ` [ruby-core:93885] " shevegen
2019-07-23 15:14 ` [ruby-core:93889] " dale.hamel
2019-08-16  2:01 ` [ruby-core:94378] " ko1
2019-08-16 12:36 ` [ruby-core:94384] " dale.hamel
2019-08-16 12:53 ` [ruby-core:94385] " ko1
2019-08-16 14:39 ` [ruby-core:94389] " dale.hamel
2019-08-17 23:49 ` [ruby-core:94406] " nobu
2019-08-24  5:10 ` [ruby-core:94524] " dale.hamel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-12093.20160220120020.b6f91fab2c2327ba@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).