Project

General

Profile

Actions

Feature #15751

closed

Add FrozenError#receiver

Added by jeremyevans0 (Jeremy Evans) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:92165]

Description

Similar to NameError#receiver, this returns the object on which
the modification was attempted. This is useful as it can pinpoint
exactly what is frozen, as in many cases when a FrozenError is
raised, you cannot determine from the context which object is
frozen that you expect not to be.

I'm not sure that using name_err_receiver as the C function for
FrozenError#receiver is acceptable, but it doesn't appear to cause
problems.

Users of the current rb_error_frozen C function will have to switch
to using rb_error_frozen_object or the new rb_raise_frozen_error
in order to set the receiver of the FrozenError.

Patch to implement this feature is attached.


Files

Add-FrozenError-receiver.patch (6.48 KB) Add-FrozenError-receiver.patch jeremyevans0 (Jeremy Evans), 04/06/2019 07:05 AM
Add-FrozenError-receiver-v2.patch (6.66 KB) Add-FrozenError-receiver-v2.patch jeremyevans0 (Jeremy Evans), 04/06/2019 06:00 PM
Add-FrozenError-receiver-v3.patch (6.49 KB) Add-FrozenError-receiver-v3.patch jeremyevans0 (Jeremy Evans), 04/07/2019 03:36 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #16419: FrozenError.new ignores receiver:Closedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0