Project

General

Profile

Feature #16971

weak_ref&.some_method should behave like object&.some_method

Added by kwerle (Kurt Werle) 3 months ago. Updated 3 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:98887]

Description

The following patterns mean basically the same thing and should behave the same:

weak_ref = WeakRef.new(some_object)
...
weak_ref.some_method if weak_ref.weakref_alive?()
some_object.some_method if some_object.present?

The some_object predicate got cleaned up by using &.some_method. It would be super clean if WeakRef did the same.

weak_ref = WeakRef.new(some_object)
...
weak_ref&.some_method # should not raise WeakRef::RefError

Also available in: Atom PDF