Project

General

Profile

Actions

Feature #16971

open

weak_ref&.some_method should behave like object&.some_method

Added by kwerle (Kurt Werle) almost 4 years ago. Updated almost 4 years ago.

Status:
Open
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
Actions

Also available in: Atom PDF

Like0
Like0