[#46918] [ruby-trunk - Bug #6820][Open] Time#to_s on NEWS — "no6v (Nobuhiro IMAI)" <nov@...>
8 messages
2012/08/01
[#46922] [ruby-trunk - Bug #6822][Open] Race Condition with Fiber and Process — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>
8 messages
2012/08/02
[#46973] [ruby-trunk - Bug #6829][Open] Failure using Win32ole (happens in 1.8.7 and 1.9 — "mvanduyn (Mitch VanDuyn)" <mitch@...>
6 messages
2012/08/03
[#46974] [ruby-trunk - Bug #6830][Assigned] test failure test_constants(OpenSSL::TestConfig) [/ruby/test/openssl/test_config.rb:27] on Mac + homebrew — "kosaki (Motohiro KOSAKI)" <kosaki.motohiro@...>
17 messages
2012/08/04
[#46978] [ruby-trunk - Bug #6832][Open] Module#instance_method and Module#method_defined? act inconsistently w.r.t #respond_to_missing? — "myronmarston (Myron Marston)" <myron.marston@...>
6 messages
2012/08/04
[#46996] [ruby-trunk - Bug #6836][Assigned] Improve File.expand_path performance in Windows — "luislavena (Luis Lavena)" <luislavena@...>
15 messages
2012/08/04
[#47021] [ruby-trunk - Bug #6836] Improve File.expand_path performance in Windows
— "luislavena (Luis Lavena)" <luislavena@...>
2012/08/06
[#47045] [ruby-trunk - Bug #6836] Improve File.expand_path performance in Windows
— "h.shirosaki (Hiroshi Shirosaki)" <h.shirosaki@...>
2012/08/07
[#47036] [ruby-trunk - Feature #6841][Open] Shorthand for Assigning Return Value of Method to Self — "wardrop (Tom Wardrop)" <tom@...>
18 messages
2012/08/07
[#52968] [ruby-trunk - Feature #6841] Shorthand for Assigning Return Value of Method to Self
— "wardrop (Tom Wardrop)" <tom@...>
2013/02/27
[#47050] [ruby-trunk - Feature #6842][Open] Add Optional Arguments to String#strip — "wardrop (Tom Wardrop)" <tom@...>
10 messages
2012/08/07
[#47091] [ruby-trunk - Feature #6847][Open] Hash#extract — "citizen428 (Michael Kohl)" <citizen428@...>
10 messages
2012/08/09
[#47094] [ruby-trunk - Bug #6849][Open] Psych.load_file throws TypeError for empty file — "BrandonMathis (Brandon Mathis)" <BeMathis@...>
4 messages
2012/08/09
[#47103] [ruby-trunk - Bug #6851][Open] Result of File.stat("c:/...") is different from 1.9.3 — "phasis68 (Heesob Park)" <phasis@...>
8 messages
2012/08/10
[#47108] [ruby-trunk - Feature #6852][Open] [].transpose should behave specially — "boris_stitnicky (Boris Stitnicky)" <boris@...>
13 messages
2012/08/10
[#47138] [ruby-trunk - Bug #6861][Open] ERB::Util.escape_html is not escaping single quotes — "spastorino (Santiago Pastorino)" <santiago@...>
14 messages
2012/08/12
[#47199] [ruby-trunk - Bug #6872][Open] Array does not specify how it determines uniqueness of values — "agrimm (Andrew Grimm)" <andrew.j.grimm@...>
8 messages
2012/08/15
[#47243] [ruby-trunk - Feature #6895][Open] TracePoint API — "ko1 (Koichi Sasada)" <redmine@...>
27 messages
2012/08/20
[#47254] [ruby-trunk - Feature #6895] TracePoint API
— "trans (Thomas Sawyer)" <transfire@...>
2012/08/20
[#47257] Re: [ruby-trunk - Feature #6895] TracePoint API
— SASADA Koichi <ko1@...>
2012/08/21
(2012/08/21 6:11), trans (Thomas Sawyer) wrote:
[#47277] [ruby-trunk - Feature #6895] TracePoint API
— "trans (Thomas Sawyer)" <transfire@...>
2012/08/22
[#47287] [ruby-trunk - Feature #6910][Assigned] Loading syck's broken yaml with psych — "naruse (Yui NARUSE)" <naruse@...>
5 messages
2012/08/23
[#47309] [ruby-trunk - Bug #6929][Open] Documentation for Ripper — "zzak (Zachary Scott)" <zachary@...>
16 messages
2012/08/25
[#47322] Re: [ruby-cvs:43987] luislavena:r36811 (trunk): Improve require/File.expand_path performance on Windows — Urabe Shyouhei <shyouhei@...>
Hello Luis,
4 messages
2012/08/27
[#47345] [ruby-trunk - Feature #6946][Open] FIPS support? — "vo.x (Vit Ondruch)" <v.ondruch@...>
35 messages
2012/08/28
[#48231] [ruby-trunk - Feature #6946] FIPS support?
— "ko1 (Koichi Sasada)" <redmine@...>
2012/10/25
[#51002] [ruby-trunk - Feature #6946] FIPS support?
— "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>
2012/12/20
[#51004] Re: [ruby-trunk - Feature #6946] FIPS support?
— SASADA Koichi <ko1@...>
2012/12/20
After that, I got the following error.
[#51006] Re: [ruby-trunk - Feature #6946] FIPS support?
— Martin Bo煬et <martin.bosslet@...>
2012/12/20
2012/12/20 SASADA Koichi <ko1@atdot.net>
[#47350] No tag for 1.8.7p370 on Github? — Charles Oliver Nutter <headius@...>
I was about to update JRuby's 1.8.7 stdlib, but there's no tag for
3 messages
2012/08/28
[#47367] [ruby-trunk - Bug #6950][Open] ruby-mode: comint-previous-input does not work — "cinsk (Seong-Kook Shin)" <cinsky@...>
6 messages
2012/08/30
[#47369] [ruby-trunk - Bug #6950] ruby-mode: comint-previous-input does not work
— "drbrain (Eric Hodel)" <drbrain@...7.net>
2012/08/30
[ruby-core:46932] [ruby-trunk - Feature #4085] Refinements and nested methods
From:
"shugo (Shugo Maeda)" <redmine@...>
Date:
2012-08-02 11:41:18 UTC
List:
ruby-core #46932
Issue #4085 has been updated by shugo (Shugo Maeda).
shugo (Shugo Maeda) wrote:
> Matz said the only problem is performance before, so I assign this issue to ko1.
I've committed refinements in r36596 with Matz's permission. However,
it's just an experimental feature, and may be reverted before the release of 2.0.
Please try it, and give us feedback.
----------------------------------------
Feature #4085: Refinements and nested methods
https://bugs.ruby-lang.org/issues/4085#change-28594
Author: shugo (Shugo Maeda)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
=begin
As I said at RubyConf 2010, I'd like to propose a new features called
"Refinements."
Refinements are similar to Classboxes. However, Refinements doesn't
support local rebinding as mentioned later. In this sense,
Refinements might be more similar to selector namespaces, but I'm not
sure because I have never seen any implementation of selector
namespaces.
In Refinements, a Ruby module is used as a namespace (or classbox) for
class extensions. Such class extensions are called refinements. For
example, the following module refines Fixnum.
module MathN
refine Fixnum do
def /(other) quo(other) end
end
end
Module#refine(klass) takes one argument, which is a class to be
extended. Module#refine also takes a block, where additional or
overriding methods of klass can be defined. In this example, MathN
refines Fixnum so that 1 / 2 returns a rational number (1/2) instead
of an integer 0.
This refinement can be enabled by the method using.
class Foo
using MathN
def foo
p 1 / 2
end
end
f = Foo.new
f.foo #=> (1/2)
p 1 / 2
In this example, the refinement in MathN is enabled in the definition
of Foo. The effective scope of the refinement is the innermost class,
module, or method where using is called; however the refinement is not
enabled before the call of using. If there is no such class, module,
or method, then the effective scope is the file where using is called.
Note that refinements are pseudo-lexically scoped. For example,
foo.baz prints not "FooExt#bar" but "Foo#bar" in the following code:
class Foo
def bar
puts "Foo#bar"
end
def baz
bar
end
end
module FooExt
refine Foo do
def bar
puts "FooExt#bar"
end
end
end
module Quux
using FooExt
foo = Foo.new
foo.bar # => FooExt#bar
foo.baz # => Foo#bar
end
Refinements are also enabled in reopened definitions of classes using
refinements and definitions of their subclasses, so they are
*pseudo*-lexically scoped.
class Foo
using MathN
end
class Foo
# MathN is enabled in a reopened definition.
p 1 / 2 #=> (1/2)
end
class Bar < Foo
# MathN is enabled in a subclass definition.
p 1 / 2 #=> (1/2)
end
If a module or class is using refinements, they are enabled in
module_eval, class_eval, and instance_eval if the receiver is the
class or module, or an instance of the class.
module A
using MathN
end
class B
using MathN
end
MathN.module_eval do
p 1 / 2 #=> (1/2)
end
A.module_eval do
p 1 / 2 #=> (1/2)
end
B.class_eval do
p 1 / 2 #=> (1/2)
end
B.new.instance_eval do
p 1 / 2 #=> (1/2)
end
Besides refinements, I'd like to propose new behavior of nested methods.
Currently, the scope of a nested method is not closed in the outer method.
def foo
def bar
puts "bar"
end
bar
end
foo #=> bar
bar #=> bar
In Ruby, there are no functions, but only methods. So there are no
right places where nested methods are defined. However, if
refinements are introduced, a refinement enabled only in the outer
method would be the right place. For example, the above code is
almost equivalent to the following code:
def foo
klass = self.class
m = Module.new {
refine klass do
def bar
puts "bar"
end
end
}
using m
bar
end
foo #=> bar
bar #=> NoMethodError
The attached patch is based on SVN trunk r29837.
=end
--
http://bugs.ruby-lang.org/