8 ms·
How is this true? Swift is very straightforward, and similar to other languages That's the argument, most people want to program in JavaScript or C++, learning
by protomyth 5y ago
How is this true? Swift is very straightforward, and similar to other languages
That's the argument, most people want to program in JavaScript or C++, learning is such a bother. The Swift syntax is more characters than ObjC's syntax.
- jbluepolarbear 5y agoNo it’s not. If you have multiple parameters Obj-C is much longer and ugly.
- iainmerrick 5y agoWhere are you getting this from? Swift’s mandatory named parameters come from Objective-C. For the most part only the bracket placement is different.
- jbluepolarbear 5y agoSwift supports default and objc doesn’t. This makes calls smaller. Swift also has argument hiding with the underscore before the parameter. Swift also ask variable arguments. Hiding named parameters and variable arguments make calls much smaller. My point stands.
- Apocryphon 5y agoThat's not really "much" longer. And in some cases the brevity saved could really increase obfuscation and confusion.
- jbluepolarbear 5y agoYes it is; especially, if there’s long parameter names. And I disagree with the obfuscation and confusion, but that’s a discussion on Swifts goal of self documentation not code length.
- stefanfisk 5y agoyou can define ObjC method parameters with empty selector names if you want. This for example is perfectly legal ObjC, callable as [foo gimmeAString:10 :"hey "]. - (NSString*)gimmeAString:(NSUInteger)count :(NSString*)piece { return [@"" stringByPaddingToLength:count withString:piece startingAtIndex:0]; }
- zionic 5y agoMandatory names parameters? You have been able to provide anonymous arguments since I first started playing with Swift in 2.0. The function just has to define it that way.
- zozbot234 5y agoC++ is of course a vastly more complex language than Swift. I don't think anyone would want to code in C++ these days if they can avoid it.
- gumby 5y agoActually plenty of people do want to and do so.
- jlarcombe 5y ago...and of course it was simple to interoperate with Objective-C in C++, in a way that it isn't for Swift, sadly
- gumby 5y agoWhich is super annoying when you have an engine written in C++, perhaps that runs on multiple platforms, and want to run it with a GUI under macOS.
- BorisRasin 5y agoYou can use Scapix Language Bridge to automatically generate bindings for various languages directly from C++ headers: https://github.com/scapix-com/scapix https://github.com/scapix-com/scapix Disclaimer: I am the author of Scapix Language Bridge.
- germandiago 5y agoI want. I do it. It gives me a level of control and a number of libs that no other language can give me, including all the C libs available as well. Yes, it is not pretty sometimes, but if you take a look at well-written C++ code you would be very surprised at how clean it can look. With its quirks from time to time, but very clean: - mark virtual overrides with override - use move semantics to increase performance - take advantage of RVO - write GUIs, CLIs, or servers - use lambdas and ranges - use smart pointers to get rid of most memory management - tune your server to allocate and deallocate in the desired patterns via polymorphic allocators or just plain allocators - take advantage of SIMD and parallelism (via parallel algorithms library, among many examples) - create generic infrastructure in algorithms with zero overhead penalty that is not even possible in other languages - keep things working for the next 2 or 3 decades without touching the code - Program in HPC environments C++ is much better than what most people that do not use it all the time think. It is not as bad as they put it, and, more important, it is very high performance. I admit this is one of the big reasons why people use it, but C++ for application programming does not look to me like crazy either.
- jshier 5y ago> The Swift syntax is more characters than ObjC's syntax. How so?
- protomyth 5y agowell, no - Swift's call syntax actually results in the same or more characters: somePoint.moveBy(x: 2.0, y: 3.0) [somePoint moveByX: 2.0 y: 3.0]; somePoint.moveBy(x: 2.0, y: 3.0, z: 4.0) [somePoint moveByX: 2.0 y: 3.0 z: 4.0];
- fingerlocks 5y agoNow do a string format example