You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Object.constants is empty (Object.constants(false) is not) #833
In MRI, Module#constants(inherit = true) on Object returns Object's own constants plus those of its ancestors; here the inherited form seems to skip the receiver's own table.
Found while writing go-scikit/ruby's interactive completion (go-scikit/ruby#8), which uses Module.constants instead for now.
Module#constants(inherit=true) always skipped Object and BasicObject, so Object.constants was empty. It now follows MRI's rb_mod_const_of: the walk stops before Object unless the receiver is Object. Verified at the tag: Object.constants lists every top-level constant (core and user-defined), Kernel.constants and the inherited form work, private constants are not listed, and Module.constants with no argument walks the caller's lexical scope. Performance: 0.33 ms for 10 000 constants on one core, level with MRI 3.4.
Order differs from MRI only inside one table, where MRI's order is unspecified and rbgo sorts.
Activity
ci: pin the ratchet's runner image — a gate's environment is not a mo…
vm: Object.constants lists top-level constants (#833) (#840)
tannevaled commentedon Oct 31, 2026
Fixed in v0.8.4 (PR #840).
Module#constants(inherit=true)always skipped Object and BasicObject, soObject.constantswas empty. It now follows MRI'srb_mod_const_of: the walk stops before Object unless the receiver is Object. Verified at the tag:Object.constantslists every top-level constant (core and user-defined),Kernel.constantsand the inherited form work, private constants are not listed, andModule.constantswith no argument walks the caller's lexical scope. Performance: 0.33 ms for 10 000 constants on one core, level with MRI 3.4.Order differs from MRI only inside one table, where MRI's order is unspecified and rbgo sorts.
🤖 Generated with Claude Code
cells: rbgo v0.8.4, complete from Object.constants (go-embedded-ruby/…