From: "byroot (Jean Boussier) via ruby-core" Date: 2026-02-10T07:58:25+00:00 Subject: [ruby-core:124755] [Ruby Feature#6478] BasicObject#__class__ Issue #6478 has been updated by byroot (Jean Boussier). > So my take on this is KERNEL_CLASS = Kernel.instance_method(:class); KERNEL_CLASS.bind_call(obj) is good enough, Yeah me too, I was just mentioning the existence of `__id__` etc. But I agree that when code need to work with any arbitrary object, like e.g. `zeitwerk` or `tapioca`, then `UnboundMethod` is the safe way. That being said it's unfortunate that it doesn't perform better on CRuby. I just had a look and It does allocate a `Class` (at least for module methods) and a `method_entry_t`, which is quite heavy for a call like `#class`. ---------------------------------------- Feature #6478: BasicObject#__class__ https://bugs.ruby-lang.org/issues/6478#change-116361 * Author: trans (Thomas Sawyer) * Status: Feedback * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- How else is one supposed to get the class of a subclass of BasicObject? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/