Hacker News new | past | comments | ask | show | jobs | submit login

As someone who started learning Objective-C only after Swift become firmly established, I have to say I strangely like the language. I picked it up fast and have had no issues with adding features to a legacy codebase.

When I started, I thought it would be some complicated beast, but no - its a reasonably simple and elegant C superset with the only disadvantage of some extra verbosity. (but Apple API's suffer from verbosity as a principle)

I have to wonder: why did Apple create Swift ? Objective-C is quite nice, especially for C/C++ programmers. With Objective-C++, interop with C++ libraries is also terrific. Swift offers nothing like this yet.




>I have to wonder: why did Apple create Swift ?

I asked this many times over the years, even in this thread [1]. Still no concrete answer. I still think overall it is a distraction.

[1] https://news.ycombinator.com/item?id=30418197


I thought it should be obvious. Apple was competing with Google/Android for mobile developers. For Android, you programmed in Java, which everyone learned in school. For iOS, this funny language with smalltalk syntax was a barrier to entry.

So Apple needed a nice language with C-like syntax to woo developers.


Plenty of Chris Lattner interviews answer that question.

https://atp.fm/205-chris-lattner-interview-transcript


I know Chris lather's intention. And I have read and listen to all the interview he did. I think the question should be, Why was it necessary for Apple to bet on Swift. Something I dont think Bertrand Serlet or Avie Tevanian would have done.


That is the answer right there, they weren't the ones calling the shots and the direction bought into Chris' intentions.


Oh well. I guess this is another thing I could blame it on Craig Federighi.


Because they wanted a modern language to power their platforms. Objective C is ancient, and showing it.


> I have to wonder: why did Apple create Swift?

They wanted a safe, performant language that interoperates with Objective-C. Safety gets them fewer vulnerabilities, interoperability means they can gradually decrease (Objective-)C usage.

Also:

- opinions on the nicety of Objective-C differ (but the only arguments I’ve heard why it would be bad more or less are “I don’t like the syntax” and “it’s verbose”, both of which, IMO, are weak. Both, IMO, are acquired tastes. I don’t think anybody is born preferring terse K&R C, for example.

- as you probably know, work is being done on C++ interop (https://github.com/apple/swift/blob/main/docs/CppInteroperab...), so that may improve.


It seems you like some ancient language which can't even concatenate a string without writing this dull statement with bunch of symbols.

  NSString *string1 = @"Some";
  NSString *string2 = @" string";
  NSString \*string3 = [string1 stringByAppendingString:string2];
Not to mention it didn't have ARC back in the days.

For sake it was built nearly 40 years ago. Not sure if there's any room to question why Apple and devs wanted a new language.

I was amazed why anyone would want to use this language before Swift but people didn't have a choice.

There were efforts like MacRuby.


To be fair, while Swift includes nice convenience methods for strings, the new API comes with a considerable cost:

https://www.mikeash.com/pyblog/friday-qa-2015-11-06-why-is-s...


That article is from 2015. A lot has changed, though some people still complain.


Doubtful that the technical underpinnings of the API have changed all that much since 2015.


They very much have.


ARC has been there for almost a decade now. Also if you wish to do heavy string concatenation, please use a NSMutableString and you can simply do: [string1 appendString:string2];

It is amazing that people forget to simply use the right tool for the right job and blame the PL instead.


Chris Lattner has mentioned that in a couple of interviews, there is a limit how much they could improve Objective-C towards being a safe systems programming language, exactly due to its C heritage.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: