-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Symbol | string to Module methods #1321
Conversation
CRuby's C APIs, `rb_check_id` and `rb_to_id`, allow Symbols and strings. The following methods that use this C API internally should allow these types. - Module#attr - Module#attr_accessor - Module#attr_reader - Module#attr_writer - Module#autoload - Module#autoload? - Module#alias_method - Module#class_variable_defined? - Module#class_variable_get - Module#class_variable_set - Module#const_defined? - Module#const_get - Module#const_set - Module#const_source_location - Module#deprecate_constant - Module#define_method - Module#instance_method - Module#method_defined? - Module#module_function - Module#public_instance_method - Module#public_method_defined? - Module#public_class_method - Module#public_constant - Module#private_method_defined? - Module#private_class_method - Module#private_constant - Module#protected_method_defined? - Module#protected_class_method - Module#remove_const - Module#remove_class_variable - Module#remove_method - Module#undef_method
def attr: (*Object::name arg0) -> Array[Symbol] | ||
def attr: (*id arg0) -> Array[Symbol] | ||
|
||
type id = Symbol | string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object::name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It's very similar to Object::name
.
However, I am questioning the correctness of Object::name
name.
The expression is ambiguous with name
.
The context here is Module
, and id
is used inside CRuby, as in rb_check_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should those using Object::name
switch to Module::id
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
CRuby's C APIs,
rb_check_id
andrb_to_id
, allow Symbols and strings. The following methods that use this C API internally should allow these types.