[MacRuby] #1391: macruby interpreter quits on 'quit' out of scope
#1391: macruby interpreter quits on 'quit' out of scope -----------------------------+---------------------------------------------- Reporter: macruby@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- 1) launch macirb 2) type: framework 'ScriptingBridge' pages = SBApplication.applicationWithBundleIdentifier("com.apple.Iwork.Pages") # or some other app... pages.quit # oops ... how silly, pages doesn't have a quit command ... but: 3) macirb itself silently quits instead -- Ticket URL: <http://www.macruby.org/trac/ticket/1391> MacRuby <http://macruby.org/>
#1391: macruby interpreter quits on 'quit' out of scope -----------------------------+---------------------------------------------- Reporter: macruby@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- Comment(by kouji@…): I coded a patch that fixes this. I put it to Gist - https://gist.github.com/1236457 . It is a quick patch. I think @alloy knows better fixing. However, this works. Thanks. -- Ticket URL: <http://www.macruby.org/trac/ticket/1391#comment:1> MacRuby <http://macruby.org/>
#1391: macruby interpreter quits on 'quit' out of scope -----------------------------+---------------------------------------------- Reporter: macruby@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- Comment(by eloy.de.enige@…): Yeah I’ve been pondering over this for a while. The solutions are to either add the method to Kernel, akin to what Kouji’s patch does, or only extend the objects that are are being used as context. E.g.: {{{ module IRB class Context module ContextMethods def quit exit end end def initialize(object, explicit_binding = nil) object.extend(ContextMethods) ... end end end }}} @Kouji What do you think is the best solution? -- Ticket URL: <http://www.macruby.org/trac/ticket/1391#comment:2> MacRuby <http://macruby.org/>
#1391: macruby interpreter quits on 'quit' out of scope -----------------------------+---------------------------------------------- Reporter: macruby@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- Comment(by kouji@…): Your idea (only extend the objects) looks good. In cRuby, IRB defines method quit(is aliased method irb_exit) of object main. IRB doesn't defines the method of Kernel. If IRB defines the method of Kernel, then we get no good behavior like the following. {{{ $ ruby -e 'def quit; p "quit"; end; 1.quit' -e:1:in `<main>': private method `quit' called for 1:Fixnum (NoMethodError) }}} So I think only extend the objects is good idea. Thanks. -- Ticket URL: <http://www.macruby.org/trac/ticket/1391#comment:3> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby