top | item 32445425

(no title)

hugey010 | 3 years ago

I never felt like this was too terrible...

  NSString* result = [NSString stringWithFormat:@"%@ %@", @"Hello", @"World"];

discuss

order

MontyCarloHall|3 years ago

I honestly can’t tell if the posts defending Objective C syntax are serious or not. Poe’s Law in action?

Compare with

  "Hello " + "world"
or if you hate operator overloading

  "{} {}".format("hello", "world")
  f"{foo} {bar}"

astrange|3 years ago

Your example is worse than stringWithFormat: for the same reason C++ iostreams are worse than format strings.

It's hard to control once you want anything more interesting than + and it's not localizable. Complaining that a function call's name is too long doesn't matter at all.