[#60404] is RB_GC_GUARD needed in rb_io_syswrite? — Eric Wong <normalperson@...>
I haven't gotten it to crash as-is, but it seems like we need to
4 messages
2014/02/01
[#60682] volatile usages — Eric Wong <normalperson@...>
Hi all, I went ahead and removed some use of volatile which were once
5 messages
2014/02/13
[#60794] [RFC] rearrange+pack vtm and time_object structs — Eric Wong <normalperson@...>
Extracted from addendum on top of Feature #9362 (cache-aligned objects).
4 messages
2014/02/16
[#61139] [ruby-trunk - Feature #9577] [Open] [PATCH] benchmark/driver.rb: align columns in text output — normalperson@...
Issue #9577 has been reported by Eric Wong.
3 messages
2014/02/28
[ruby-core:60989] [ruby-trunk - Feature #9552] Module map!
From:
boris@...
Date:
2014-02-22 06:52:47 UTC
List:
ruby-core #60989
Issue #9552 has been updated by Boris Stitnicky.
Core-level syntax might be similar to that of `alias`,
```ruby
class FooBarBazCollection
map! fn foos, barn bar, bazn bazs do |retval| retval.map &:name end
end
```
Another approach (without introducing a new keyword, which might be considered feature creep) would be to somehow make it possible for the built-in argument field validation of one method to be applied to another method. But that would probably require more introspection regarding the argument field than present day `#arity` method offers, and also the possibility to unbind the argument field validation routine from a method and reuse it in another method. Then, perfect `Module#map!` could be written and there would be no pressing need for new keywords.
----------------------------------------
Feature #9552: Module map!
https://bugs.ruby-lang.org/issues/9552#change-45390
* Author: Boris Stitnicky
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
I would like to beg for `map!` directive in `Module`. I can imitate it with this code:
```ruby
class Module
def map! **hash, &block
hash.each_pair { |mapped_method_symbol, original_method_symbol|
define_method mapped_method_symbol do |*args, &b|
block.( send original_method_symbol, *args, &b )
end
}
end
end
```
And then
```ruby
class Foo; attr_accessor :name end
class Bar; attr_accessor :name end
class Baz; attr_accessor :name end
class FooBarBazCollection < Array
def foos; select { |e| e.is_a? Place } end
def bars; select { |e| e.is_a? Transition } end
def bazs; select { |e| e.is_a? Arc } end
map! fn: :foos, barn: :bars, bazn: :bazs do |retval| retval.map &:name end
end
```
I solemnly declare that I have encountered this pattern in my work on Petri net gem sufficiently many times to warrant this meta approach. The above method `#map!` is not perfect, because it makes the "mapped" methods more omnivorous -- accepting even such sets of arguments, for which the originals returned `ArgumentError`. I do not know how to solve this without asking for a core-level solution.
--
http://bugs.ruby-lang.org/