I'm playing again with implementing the Hillegass book in MacRuby, and ran 
across this 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 invalid syntax:

    NSAlert.alertWithMessageText("Delete?",
                   defaultButton:"Delete",
                 alternateButton:"Cancel",
                     otherButton:nil,
       informativeTextWithFormat:"delete %d people?",
                                  employees.count)


Surely, in this case it can be worked around with:

    NSAlert.alertWithMessageText("Delete?",
                   defaultButton:"Delete",
                 alternateButton:"Cancel",
                     otherButton:nil,
       informativeTextWithFormat:"delete #{employees.count} people?")

And I can also call it as:

    NSAlert.send(
      
:"alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:",
      "Delete?", "Delete", "Cancel", nil, "delete %@ people?", employees.count)

but I was wondering if this is a known limitation in MacRuby's method call 
syntax.

So, is it known? Is there a plan to do anything about it?

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to