From: merch-redmine@... Date: 2019-04-07T03:40:26+00:00 Subject: [ruby-core:92171] [Ruby trunk Feature#15751] Add FrozenError#receiver Issue #15751 has been updated by jeremyevans0 (Jeremy Evans). File Add-FrozenError-receiver-v3.patch added nobu (Nobuyoshi Nakada) wrote: > I haven't look C-API well, the additional argument would be ok. > `rb_raise_frozen_error` should be `rb_frozen_error_raise` like `rb_name_err_raise`? > > As for the test, `assert_same` would be better for the equality of the receiver. OK, v3 of the patch is attached, based off the initial patch with the positional argument, with the function renamed to `rb_frozen_error_raise` and using `assert_same` in the tests. Eregon (Benoit Daloze) wrote: > In the patch in `rb_raise_frozen_error`, `exc` is used for both the message and the exception object, could you use different variables? > I find it confusing to use the same and re-assign it when there is no need. v3 patch includes this change as well. ---------------------------------------- Feature #15751: Add FrozenError#receiver https://bugs.ruby-lang.org/issues/15751#change-77498 * Author: jeremyevans0 (Jeremy Evans) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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-v2.patch (6.66 KB) Add-FrozenError-receiver-v3.patch (6.49 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: