[#73707] [Ruby trunk Misc#12004] Code of Conduct — hanmac@...
Issue #12004 has been updated by Hans Mackowiak.
3 messages
2016/02/05
[#73730] [Ruby trunk Feature#12034] RegExp does not respect file encoding directive — nobu@...
Issue #12034 has been updated by Nobuyoshi Nakada.
3 messages
2016/02/07
[#73746] [Ruby trunk Feature#12034] RegExp does not respect file encoding directive — nobu@...
Issue #12034 has been updated by Nobuyoshi Nakada.
3 messages
2016/02/09
[#73919] [Ruby trunk Feature#11262] Make more objects behave like "Functions" — Ruby-Lang@...
SXNzdWUgIzExMjYyIGhhcyBiZWVuIHVwZGF0ZWQgYnkgSsO2cmcgVyBNaXR0YWcuCgpQcm9qZWN0
3 messages
2016/02/22
[#74019] [Ruby trunk Bug#12103][Rejected] ruby process hangs while executing regular expression. — duerst@...
SXNzdWUgIzEyMTAzIGhhcyBiZWVuIHVwZGF0ZWQgYnkgTWFydGluIETDvHJzdC4KClN0YXR1cyBj
3 messages
2016/02/27
[ruby-core:73886] [Ruby trunk Bug#12086] using: option for instance_eval etc.
From:
shugo@...
Date:
2016-02-19 07:34:02 UTC
List:
ruby-core #73886
Issue #12086 has been reported by Shugo Maeda.
----------------------------------------
Bug #12086: using: option for instance_eval etc.
https://bugs.ruby-lang.org/issues/12086
* Author: Shugo Maeda
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Currently refinements can be activated only in toplevel or class/module definitions.
If they can be activated in block-level, it's useful to implement internal DSLs.
How about to add a new option using: for Kernel#instance_eval and Moule#{class,module}_eval?
```ruby
module FixnumDivExt
refine Fixnum do
def /(other)
quo(other)
end
end
end
p 1 / 2 #=> 0
instance_eval(using: FixnumDivExt) do
p 1 / 2 #=> (1/2)
end
p 1 / 2 #=> 0
```
Proof-of-concept implementation is available at <https://github.com/shugo/ruby/tree/eval_using>.
In my previous proposal before Ruby 2.0, refinements used in a class or module are
implicitly activated by instance_eval and class_eval, but now I think it's better to
explicitly specify refinements to be activated.
Considerations:
* In the PoC implementation, refined methods are not cached inline, and thus it decreases
the performance of refined method call.
If there is a way to guarantee that blocks never be evaluated in different environments,
refined methods can be cached inline.
* {instance,class,module}_exec cannot be extended in the same way, because they take arbitrary
arguments and there's no way to distinguish an option hash from the last argument hash.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>