You would have 2 lines of code per property but one fewer concept—and I think that is a much more important factor. To me—this was not the right way to add sugar.
You would have 2 lines of code per property but one fewer concept—and I think that is a much more important factor. To me—this was not the right way to add sugar.
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.
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.
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.
So Apple needed a nice language with C-like syntax to woo developers.
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.
https://www.mikeash.com/pyblog/friday-qa-2015-11-06-why-is-s...
It is amazing that people forget to simply use the right tool for the right job and blame the PL instead.