[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
VGhhbmtzIHRvIGV4cGxhaW4gdGhhdC4KCj4gSSBzdXNwZWN0IHRoZXJlIGlzIGFub3RoZXIgdGhy
[#91154] Testing MJIT on RHEL 7.5 — Phil Edelbrock <edelbrp@...>
4 messages
2019/01/18
[#91159] Re: Testing MJIT on RHEL 7.5
— Takashi Kokubun <takashikkbn@...>
2019/01/18
SGksCgo+IHRpbWUgL3Vzci9sb2NhbC9ydWJ5LWVkZ2UvYmluL3J1YnkgLS1kaXNhYmxlLWdlbXMg
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:90936] [Ruby trunk Feature#15483] Proc or Method combination with Symbol
From:
nobu@...
Date:
2019-01-09 05:40:58 UTC
List:
ruby-core #90936
Issue #15483 has been updated by nobu (Nobuyoshi Nakada).
Why not using refinements?
```ruby
# symbol/functionalized.rb
module Symbol::Functionalized
refine(Symbol) do
def call(*args, &block)
to_proc.call(*args, &block)
end
def <<(other = (b = true), &block)
to_proc << (b ? block : other.to_proc)
end
def >>(other = (b = true), &block)
to_proc >> (b ? block : other.to_proc)
end
end
end
```
```ruby
require 'symbol/functionalized'
using Symbol::Functionalized
p %w{72 101 108 108 111}.map(&:to_i >> :chr) #=> ["H", "e", "l", "l", "o"]
```
----------------------------------------
Feature #15483: Proc or Method combination with Symbol
https://bugs.ruby-lang.org/issues/15483#change-76134
* Author: aycabta (aycabta .)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
In [Feature #6284], Matz said
> We need more discussion if we would add combination methods to the Symbol class.
Right, let's get started to discuss.
For your information, recent a few months I'm discussing this with @osyo .
## This is a discussion of "design"
I understand that all features of this issue have both merits and demerits, but I guess that language design is most important. All features of this issue related to each other.
## Abstract
At present, you can use `Proc#>>` or `Proc#<<` with `Symbol#to_proc`.
```ruby
%w{72 101 108 108 111}.map(&(:to_i.to_proc >> :chr.to_proc))
# => ["H", "e", "l", "l", "o"]
```
This is convenient but methods that take block can take a proc with `&` syntax sugar instead of `#to_proc` by right, like `[1, 2, 3].map(&:to_s)`. So `Symbol#to_proc` looks like too long for `Proc#>>` or `Proc#<<`. Therefore, you need new syntax sugar.
## Receiver
### `Symbol#>>` and `Symbol#<<`
`Symbol#>>` and `Symbol#<<` will be considered, but this means that `Symbol` is treated as `Proc` partially. The `[1, 2, 3].map(&:to_s)` treats `Symbol` as `Proc` partially too, but it's with pre-positioned `&`.
```ruby
%w{72 101 108 108 111}.map(&(:to_i >> :chr.to_proc))
# => ["H", "e", "l", "l", "o"]
```
I can't come up with other ideas for the `Symbol` receiver.
### New `&:symbol_name` syntax sugar for `:symbol_name.to_proc`
```ruby
%w{72 101 108 108 111}.map(&(&:to_i >> :chr.to_proc)))
# => ["H", "e", "l", "l", "o"]
```
## Argument
### Calls `#to_proc` by `Proc#>>` or `Proc#<<` internally as a duck typing
```ruby
%w{72 101 108 108 111}.map(&(:to_i.to_proc >> :chr))
# => ["H", "e", "l", "l", "o"]
```
In this case, `Proc#>>`(`:to_i.to_proc >>`) calls `Symbol#to_proc`(for `:chr`) inside.
This is useful to use with `Hash#to_proc`:
```ruby
h = { Alice: 30, Bob: 60, Cris: 90 }
%w{Alice Bob Cris}.map(&(:to_sym.to_proc >> h))
# => [30, 60, 90]
```
### `Proc#>>` and `Proc#<<` take block as an argument
```ruby
%w{72 101 108 108 111}.map(&(:to_i.to_proc >> &:chr))
```
## Combination of receiver and argument
`Symbol#>>` and calling `#to_proc` internally:
```ruby
%w{72 101 108 108 111}.map(&(:to_i >> :chr))
# => ["H", "e", "l", "l", "o"]
```
`&:symbol_name` syntax sugar for `:symbol_name.to_proc` and `Symbol#>>` and taking block:
```ruby
%w{72 101 108 108 111}.map(&(&:to_i >> &:chr))
# => ["H", "e", "l", "l", "o"]
```
--
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>