https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112012-07-09T15:55:50ZRuby Issue Tracking SystemRuby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=278852012-07-09T15:55:50Zko1 (Koichi Sasada)
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/27885/diff?detail_id=20619">diff</a>)</li><li><strong>Category</strong> set to <i>core</i></li><li><strong>Assignee</strong> set to <i>matz (Yukihiro Matsumoto)</i></li><li><strong>Target version</strong> set to <i>2.0.0</i></li></ul> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=278972012-07-09T23:19:54Zjballanc (Joshua Ballanco)jballanc@gmail.com
<ul></ul><p>=begin<br>
I like this idea, but I have one question: why make this a special argument to <code>eval</code> and not to <code>Binding.new</code>? I've wanted <code>Binding</code> to become better specified and more refined for some time now, and I think this would be a good step in the right direction. I think at some point it would be good to think about all of the things that can happen in a binding (e.g. specify locals, shadow locals, function defs, shadow defs, new classes, reopening classes, etc.), and give an API to tell bindings what they can and cannot do.</p>
<p>So, in this case, ISOLATED_BINDING would be something like<br>
b = Binding.new(TOPLEVEL_BINDING) # New binding "inherits" from Top Level (but not same as class inheritance)<br>
b.live_locals = false # This binding will not propagate locals to its "parent" binding (TOPLEVEL_BINDING, in this case)<br>
eval('def foo; end; a = 10', b) # method foo is now available, but local "a" is not</p>
<p>This, obviously, requires a lot more thought and work, but for now we could maybe at least have <code>Binding.new(isolated: true)</code> as shorthand for the case described above?<br>
=end</p> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=279032012-07-10T03:59:10Zko1 (Koichi Sasada)
<ul></ul><p>Hi,</p>
<p>(2012/07/09 23:19), jballanc (Joshua Ballanco) wrote:</p>
<blockquote>
<p>I like this idea, but I have one question: why make this a special argument to <code>eval</code> and not to <code>Binding.new</code>?</p>
</blockquote>
<p>Just a performance. My proposal doesn't make any binding object.<br>
It is similar that `nil' specifier (means current binding).</p>
<blockquote>
<p>I've wanted <code>Binding</code> to become better specified and more refined for some time now, and I think this would be a good step in the right direction. I think at some point it would be good to think about all of the things that can happen in a binding (e.g. specify locals, shadow locals, function defs, shadow defs, new classes, reopening classes, etc.), and give an API to tell bindings what they can and cannot do.</p>
<p>So, in this case, ISOLATED_BINDING would be something like<br>
b = Binding.new(TOPLEVEL_BINDING) # New binding "inherits" from Top Level (but not same as class inheritance)<br>
b.live_locals = false # This binding will not propagate locals to its "parent" binding (TOPLEVEL_BINDING, in this case)<br>
eval('def foo; end; a = 10', b) # method foo is now available, but local "a" is not</p>
<p>This, obviously, requires a lot more thought and work, but for now we could maybe at least have <code>Binding.new(isolated: true)</code> as shorthand for the case described above?</p>
</blockquote>
<p>This is another feature. Make another ticket for it if you want.<br>
I agree that we need more and more thought to introduce your proposal.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=281032012-07-14T18:41:03Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li></ul> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=319472012-10-30T08:47:45Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Assignee</strong> changed from <i>matz (Yukihiro Matsumoto)</i> to <i>ko1 (Koichi Sasada)</i></li></ul><p>Ko1, explain why you need modify eval, where we can create new isolated binding.<br>
I don't think small performance improvement is a good excuse.</p>
<p>Matz.</p> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=319512012-10-30T09:01:06Zko1 (Koichi Sasada)
<ul></ul><p>Yes, (small) performance issue.</p>
<p>Okay, let's discuss how to make such binding. I think we have several choice.</p>
<ul>
<li>Binding.new</li>
<li>Binding.new(:isolated)</li>
</ul>
<p>Or do we need to discuss jballanc's proposal in another ticket and reject this ticket? I'm okay this way.</p> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=337042012-11-24T10:08:13Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Target version</strong> changed from <i>2.0.0</i> to <i>2.6</i></li></ul> Ruby master - Feature #6710: new special binding specifier :isolatedhttps://redmine.ruby-lang.org/issues/6710?journal_id=627852017-01-31T09:38:49Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Rejected</i></li></ul>