开发者

__respond_to_eh__ in Rubinius, eh?

In Rubinius, if you do

rb开发者_运维问答x-head > Object.instance_methods.grep(/^_.*/)
 => ["__extend__", "__show__", "__marshal__", "__instance_of__", "__instance_variable_get__", "__send__", "__id__", "__instance_variable_set__", "__respond_to_eh__", "__instance_variables__", "__class__", "__kind_of__", "__instance_variable_defined_eh__", "__nil__", "__metaclass__", "__fixnum__", "__method__"] 

which includes "__respond_to_eh__" and "__instance_variable_defined_eh__".

So this is because the Rubinius folk want to wrap method names that shouldn't be messed with with __, and you aren't allowed to use ? before the end of a method name, eh?


They've now changed to using __instance_variable_defined_p__ and __respond_to_p__ in predicates like everywhere else, according to their comments.

Meh.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜