[MacRuby] #950: no syntax for method calls with unnamed arguments after the pseudo-hash part of the selector
#950: no syntax for method calls with unnamed arguments after the pseudo-hash part of the selector ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ NSAlert defines the following method: {{{ + (NSAlert *)alertWithMessageText:(NSString *)messageTitle defaultButton:(NSString *)defaultButtonTitle alternateButton:(NSString *)alternateButtonTitle otherButton:(NSString *)otherButtonTitle informativeTextWithFormat:(NSString *)informativeText, ... }}} (http://bit.ly/d1JIeQ) Now, the interesting part here is the "`, ...`" at the end. It takes variable arguments at the end that work as formatting arguments for `informativeText`, eg.` sprintf(informativeText, ...)`. In MacRuby, this is currently invalid syntax: {{{ NSAlert.alertWithMessageText("Delete?", defaultButton:"Delete", alternateButton:"Cancel", otherButton:nil, informativeTextWithFormat:"delete %d people?", employees.count) }}} The only way around it is using `send`: {{{ NSAlert.send( :"alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:", "Delete?", "Delete", "Cancel", nil, "delete %@ people?", employees.count) }}} Mailing list thread: http://lists.macosforge.org/pipermail/macruby- devel/2010-October/006179.html -- Ticket URL: <http://www.macruby.org/trac/ticket/950> MacRuby <http://macruby.org/>
#950: no syntax for method calls with unnamed arguments after the pseudo-hash part of the selector ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): Isn't this similar to #106 ? -- Ticket URL: <http://www.macruby.org/trac/ticket/950#comment:1> MacRuby <http://macruby.org/>
#950: no syntax for method calls with unnamed arguments after the pseudo-hash part of the selector ---------------------------------+------------------------------------------ Reporter: dev@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: duplicate Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => duplicate Comment: Indeed, it's a dup. -- Ticket URL: <http://www.macruby.org/trac/ticket/950#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby