[MacRuby] #950: no syntax for method calls with unnamed arguments after the pseudo-hash part of the selector
MacRuby
ruby-noreply at macosforge.org
Sun Oct 10 14:50:59 PDT 2010
#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/>
More information about the macruby-tickets
mailing list