[#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:108952] [Ruby master Bug#18826] Symbol#to_proc inconsistent, sometimes calls private methods
From:
"matz (Yukihiro Matsumoto)" <noreply@...>
Date:
2022-06-16 07:27:36 UTC
List:
ruby-core #108952
Issue #18826 has been updated by matz (Yukihiro Matsumoto).
In general, `a.b(&:c)` should behave exactly the same as `a.b{_1.c}`. But visibility check for `protected` methods may be too difficult for `to_proc`. So rejecting `protected` methods altogether like `private` methods is acceptable.
Matz.
----------------------------------------
Bug #18826: Symbol#to_proc inconsistent, sometimes calls private methods
https://bugs.ruby-lang.org/issues/18826#change-98047
* 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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>