Comment

Comment by mikeash

Unfortunately, although there's no particular reason for it, you're not allowed to write a method that takes only variadic arguments. This doesn't work:

    - (NSString *)format: ...;
It would be oh-so convenient, meaning you could write formatting operations like this:

    newstr = [@"%d %@ %s" format: 42, @"blah", "yep"];
Given the constraints we have to work with, I'd say your best bet would be to simply write a function:

    newstr = fmt(@"%d %@ %s", 42, @"blah", "yep");
parent mikeash 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton