5 ms·
It's a systems language, and imo way more beautiful than c++.
by manmal 10y ago
It's a systems language, and imo way more beautiful than c++.
- superJimmy64 10y agoAbsolutely. I'm not attempting to put it down as somehow not worthy of anyones time, just thought I'd mention how "cushioned" it all felt :P
- manmal 10y agoWhat language do you prefer over Swift? I'm curious.
- superJimmy64 10y agoI'm not sure I would choose something over the latest version, primarily because of how little a time investment using it can be... but then again it all comes down to what the task at hand is doesn't it ;P
- snovv_crash 10y agoC++11 with review-enforced RAII. Boost if you need special stuff involving odd data structures. gtest/gmock. Depending on what you're doing, add some Qt5, OpenCV, OpenMP, RapidXML/RapidJSON, any C library ever written - and there are BSD/LGPL libraries for pretty much anything. Make plugins with Lua. Run tests in Valgrind.
- deleted 10y ago[deleted]
- mpweiher 10y agoIt's not really predictable enough for a systems language.
- pjmlp 10y agoCan you predict what your C compiler with going to do with your code, taking into account UB and compiler specific implementation behaviors not specified by ANSI C?
- mpweiher 10y agoMore than with Swift. I routinely see 100x - 1000x and more performance difference between -O0 and -O in Swift. Considering that the optimiser doesn't give warnings or errors if it can't apply optimisations, that's out of bounds for me for a systems programming language. YMMV. The whole UB idiocy is a different matter, though related because it's perpetrated by roughly the same group of people, for similar nonsensical and non-validated reasons. See my post http://blog.metaobject.com/2014/04/cc-osmartass.html http://blog.metaobject.com/2014/04/cc-osmartass.html See also: http://www.complang.tuwien.ac.at/kps2015/proceedings/KPS_2015_submission_29.pdf http://www.complang.tuwien.ac.at/kps2015/proceedings/KPS_201... and Proebsting's Law.
- pjmlp 10y ago> More than with Swift. I routinely see 100x - 1000x and more performance difference between -O0 and -O in Swift. Considering that the optimiser doesn't give warnings or errors if it can't apply optimisations, that's out of bounds for me for a systems programming language. YMMV. Improvements required for the toolchain in a young language, than Apple, IBM and others will certainly improve.
- themihai 10y agoYeah but it can't replace C++. Swift was designed to make programming fun/nice not to replace C or C++.
- superJimmy64 10y agoAgreed. Certainly if the dev has any regard for things like performance and security
- pjmlp 10y ago"Swift is intended as a replacement for C-based languages (C, C++, and Objective-C). " Taken from https://swift.org/about/ https://swift.org/about/ "Swift is a successor to both the C and Objective-C languages." Taken from https://developer.apple.com/swift/ https://developer.apple.com/swift/
- themihai 10y agoSwift can't do realtime. It has automatic memory management. How do you replace C or C++ with Swift for that? What they mean is that Swift replaces Objective-C on user facing apps(on Apple devices) but I doubt you will see the critical parts of the OS (kernel, drivers, etc) written in Swift. It's almost like saying javascript will replace C/C++. I want a nice language like Swift (or Go) to replace C but there is none. Rust was the best/latest failed attempt.
- mikeash 10y agoYou can essentially write C in Swift by using UnsafePointer and such. If you avoid using reference types then you won't get any automatic memory management. I don't think it's quite ready to replace C as a kernel or driver language, but it's not that far off.
- aaronbrager 10y agoThis is especially true in Swift 3, which has many improvements around this type of programming.