Project

General

Profile

Feature #16419

FrozenError.new ignores receiver:

Added by znz (Kazuhiro NISHIYAMA) 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:96227]

Description

Other exception classes with receiver accept recevier as keyword argument of new.
But FrozenError.new accept as positional argument.
I think keyword argument is better consistency.

% git grep 'receiver[:=]' ../error.c
../error.c: *   FrozenError.new(msg=nil, receiver=nil)  -> name_error
../error.c: *   NameError.new(msg=nil, name=nil, receiver: nil)  -> name_error
../error.c: *    [1, 2, 3].method(:rject) # NameError with name "rject" and receiver: Array
../error.c: *    [1, 2, 3].singleton_method(:rject) # NameError with name "rject" and receiver: [1, 2, 3]
../error.c: *   NoMethodError.new(msg=nil, name=nil, args=nil, private=false, receiver: nil)  -> no_method_error
../error.c: *   KeyError.new(message=nil, receiver: nil, key: nil) -> key_error

Related issues

Related to Ruby master - Feature #15751: Add FrozenError#receiverClosedActions
#1

Updated by znz (Kazuhiro NISHIYAMA) 4 months ago

Updated by jeremyevans0 (Jeremy Evans) 4 months ago

Whether to use a positional argument or a keyword argument was discussed in #15751. I don't have a strong feelings either way (one of the patches I added in #15751 supported keyword arguments), and I don't think Eregon (Benoit Daloze) or nobu (Nobuyoshi Nakada) had strong feelings either. If you are strongly in favor of switching to a keyword argument, please commit the change. I'll probably not be in a position to commit anything until December 20.

Updated by znz (Kazuhiro NISHIYAMA) 4 months ago

  • Assignee changed from jeremyevans0 (Jeremy Evans) to matz (Yukihiro Matsumoto)
#4

Updated by nobu (Nobuyoshi Nakada) 4 months ago

  • Status changed from Open to Closed

Applied in changeset git|435a4ca2a38f3be1f5d2db0f71487a52c8285e9c.


Makes the receiver to FrozenError.new a keyword parameter

[Feature #16419]

Also available in: Atom PDF