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
Hosted top-level alias/undef/visibility/define_method still act only on main's singleton class #177
Since #174, in a scope-bound hosted run (ScriptCode.Run(Scope), Engine.Execute(code, scope), ScriptSource.Execute(scope)), a top-level def defines the method on main's singleton class and on Object, as CRuby does. Other top-level method-table operations still act only on main's singleton class:
top-level alias / alias_method
top-level undef / undef_method
public / private with method names at the top level
main.define_method
So, for example, after Execute("def foo = 1; alias bar foo", scope), a call to bar from inside a class raises NameError, while in CRuby it works. ir is not affected, because its top level is not scope-bound.
Also from #163's side note, still open: in hosted top-level code, def self.x is labelled Object#x in backtraces, where CRuby prints x. The label is computed in four places from the declaring module alone, and those places don't know whether the def had an explicit target.
Activity
Merge pull request #179 from Largo/claude/hosted-toplevel-ops