[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108907] [Ruby master Bug#18826] Symbol#to_proc inconsistent, sometimes calls private methods
From:
"Eregon (Benoit Daloze)" <noreply@...>
Date:
2022-06-14 10:44:50 UTC
List:
ruby-core #108907
Issue #18826 has been updated by Eregon (Benoit Daloze).
Also worth noting that for performance purposes, `Symbol#to_proc` should be able to be cached globally, i.e., cache the Proc in the/per Symbol instance.
So then the `self` inside that Proc should be a sentinel value (`nil` or the Symbol itself).
----------------------------------------
Bug #18826: Symbol#to_proc inconsistent, sometimes calls private methods
https://bugs.ruby-lang.org/issues/18826#change-97991
* Author: bjfish (Brandon Fish)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
The following usage calls a protected method and prints "hello":
``` ruby
class Test
protected
def referenced_columns
puts "hello"
end
end
Test.new.tap(&:referenced_columns)
```
However, the following usage results in a NoMethodError:
``` ruby
class Integer
private
def foo
42
end
end
(1..4).collect(&:foo)
```
It seems to be a bug that tap calls a private method. It is also inconsistent with collect not calling private methods.
--
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>