-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Description
Description
Given the code:
class Foo
def foo
binding.irb
puts "Hello"
end
end
Foo.new.fooIf we run ls from binding.irb, we'd get
Foo.methods:
backtrace bindings bt cb chws conf context continue cws cwws debug delete edit exit fg finish help info
irb_bindings irb_cb irb_change_binding irb_chws irb_current_working_binding irb_cwb irb_cws irb_cwws irb_pop_binding irb_popb irb_popws irb_print_working_binding irb_print_working_workspace irb_push_binding irb_pushb irb_pushws irb_pwb irb_pwws
irb_quit jobs kill ls measure popb popws pushb pushws pwws quit show_cmds show_doc show_source source step whereami workspaces
IRB::ExtendCommandBundle#methods:
install_alias_method irb irb_backtrace irb_break irb_catch irb_change_workspace irb_context irb_continue irb_current_working_workspace irb_debug irb_debug_info irb_delete irb_edit irb_exit irb_fg irb_finish irb_help
irb_info irb_jobs irb_kill irb_load irb_ls irb_measure irb_next irb_pop_workspace irb_push_workspace irb_require irb_show_cmds irb_show_doc irb_show_source irb_source irb_step irb_whereami irb_workspaces
Foo#methods: foo
locals: _
=> nil
This shows that IRB's command methods got added to the object, which is a pretty bad side-effect. This is because IRB directly calls extend(ExtendCommandBundle) on the context.main here.
I think we should stop treating commands as methods to properly solve this, which will also make command extension API easier to implement.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working