[#78949] [Ruby trunk Feature#13095] [PATCH] io.c (rb_f_syscall): remove deprecation notice — kosaki.motohiro@...
Issue #13095 has been updated by Motohiro KOSAKI.
3 messages
2017/01/03
[#78997] [Ruby trunk Bug#13110] Byte-based operations for String — shugo@...
Issue #13110 has been updated by Shugo Maeda.
3 messages
2017/01/06
[#79228] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150] — Eric Wong <normalperson@...>
naruse@ruby-lang.org wrote:
5 messages
2017/01/23
[#79511] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Eric Wong <normalperson@...>
2017/02/13
Eric Wong <normalperson@yhbt.net> wrote:
[#79518] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Nobuyoshi Nakada <nobu@...>
2017/02/13
On 2017/02/13 10:04, Eric Wong wrote:
[#79298] [Ruby trunk Bug#13085][Assigned] io.c io_fwrite creates garbage — nobu@...
Issue #13085 has been updated by Nobuyoshi Nakada.
3 messages
2017/01/29
[#79337] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write — SASADA Koichi <ko1@...>
Eric:
4 messages
2017/01/31
[#79352] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write
— Eric Wong <normalperson@...>
2017/01/31
SASADA Koichi <ko1@atdot.net> wrote:
[ruby-core:79359] [Ruby trunk Feature#6710][Rejected] new special binding specifier :isolated
From:
ko1@...
Date:
2017-01-31 09:38:49 UTC
List:
ruby-core #79359
Issue #6710 has been updated by Koichi Sasada.
Status changed from Assigned to Rejected
----------------------------------------
Feature #6710: new special binding specifier :isolated
https://bugs.ruby-lang.org/issues/6710#change-62785
* Author: Koichi Sasada
* Status: Rejected
* Priority: Normal
* Assignee: Koichi Sasada
* Target version: next minor
----------------------------------------
=begin
= Abstract
New special binding specifier :isolated for the 2nd argument of eval() method.
eval(src, :isolated) evaluates `src' program on the same environment as `require' and 'load'.
It is a bit different from `TOPLEVEL_BINDING'.
= Background
We have TOPLEVEL_BINDING to evaluate source code on the main environment (self is `main', and so on).
However, TOPLEVEL_BINDING contains local variables which are evaluated in toplevel.
For example:
x = 10
eval('a=1', TOPLEVEL_BINDING)
eval('b=2', TOPLEVEL_BINDING)
eval('c=3', TOPLEVEL_BINDING)
eval('p (a+b+c) * x', TOPLEVEL_BINDING) #=> 60
To simulate "require()" or "load()" method, the eval() method with TOPLEVEL_BINDING is not enough (require() and load() methods don't evaluate scripts within `main' environment. Similar to `main' environment (self == main), but local variables aren't taken over).
BTW, eval() receive special binding specifier `nil' (which means current binding).
= Proposal
Introduce the new special binding specifier :isolated for the 2nd argument of eval() method.
eval(src, :isolated) evaluates `src' program on the new binding, which is same environment as `require' and 'load'.
== Usecase
Users can define toplevel methods, modules, classes on the any places.
def m
# define toplevel method foo()
eval('def foo(); end', :isolated)
# define ::Bar class
eval('class Bar; end', :isolated)
end
Users can make your own alternative require() method.
def my_require(feature)
... # set src from feature
eval(src, :isolated)
...
end
== Consideration
* :isolated is good name or not?
I'm not sure the `isolated' is good name or not.
* ISOLATED_BINDING = :isolated
If make default constants ::ISOLATED_BINDING as a :isolated, then we can use it as `eval(src, ISOLATED_BINDING)', similar manner with TOPLEVEL_BINDING.
= Acknowledgment
Usa-san proposed the name `isolated'. My first idea of this name is `empty'.
=end
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>