Winding down the Swift 3 release
thread.gmane.org
thread.gmane.org
That said, Go's tooling, documentation, and ecosystem are much friendlier than Swift's. And since most of us spend more time doing that stuff than actually typing code, it's an important point for me in the comparison.
Go I don't like the design, but I will always suggest it to anyone wanting a simple safe C like language.
D, the community is great, but they still need to decide which direction the language is supposed to grow.
Rust community and language are great, but I think they need to get into an OS SDK to really accomplish the goal of replacing C++.
Swift is replacing C and Objective-C as the official systems language on Apple platforms. It has the necessary tooling for full stack applications, IBM is already pushing it on their cloud services and Microsoft will eventually support it on their iOS bridge.
So in what concerns OS vendor support I am betting on Swift.
For the use cases where that isn't relevant, I would say Rust is also a very good candidate.
But the ones that kept surviving between OS generations were the ones being sold by the OS / hardware vendors for their systems, not the ones being sold by third party software companies.
You just need to compare the tooling offered for the programming languages that are part of an OS SDK, with the platform support for other programming languages not part of the SDK.
Bringing an external systems programming language means additional development effort, spent in wrapping OS libraries, integration with debugging tools, compiler toolchains.
Hence why many companies are willing only to work with programming languages that have first class support on the platforms they are targeting.
However, there are also some companies for which such issues don't matter. So if there is a big number of such companies, eventually an OS vendor does pay attention and adds such a language into their offerings.
1) go is not a suitable candidate for android, as most of the api's are object orientated and involve subclassing sdk classes, which would be awkward and painfull on golang, but not so hard on swift.
2) they would pick up a bunch of companies and devs that are currently building high quality apps for iOS, if swift does succeed in abstracting the foundation classes and provide a reasonable abstraction of the UI classes, it would open up the potential of a universal "app" language, for Mac, Linux, android and iOS.
This may be wishful thinking, but it's worth pushing a few Braincells in that direction.
It has all the advantages of Go but with a more expressive language, much better C interop and a platform that will create a community around it very quickly, the other day I saw somewhere that there are already more Swift books and courses than Go. Swift will also let you do everything Rust can, very low level stuff.
Not quite. Swift requires a runtime, so you probably won't see people writing OS kernels in Swift.
[1] https://www.rust-lang.org/faq.html#does-rust-have-a-runtime (also mentions what's in the C runtime)
IIRC, Swift's runtime is like C++'s with v-table lookup for dispatch on functions that do not involve Objective-C objects.
(For the record, I believe Chris Lattner is on the record as saying "yes, Swift has a runtime, let's not bother arguing that point" though I can't find the link, but I agree that Swift's runtime is less invasive than most other languages (e.g. Go).)
And the Swift runtime is pretty minimal, mostly used for storing dynamic type information, dispatching protocol methods, generating (unspecialised) generic types, checking conformances etc. It's mostly used by the compiler to add the dynamic features of the language; for example, the compiler observes the lifetimes of variables and inserts retain/release instructions, which are lowered down to a swift_retain or swift_release calls on the runtime instance. These functions are implemented in the runtime and do the manipulation of reference counts and deallocation.
https://github.com/apple/swift/tree/master/stdlib/public/run...
Also, Swift, unlike Objective-C, is not a superset of C.
Which also happens to have a runtime, crt0.o.
Usually in these scenarios I believe it just requires a company to bully developers to accept it and an eventual generation change.
If tomorrow Apple decides, for whatever reason, that new kext or IOKit modules are to be written in Swift, then whoever cares about their Apple OS customers will just comply with it.
However if you are willing to accept some functionality will be written in C it is possible to run Swift directly on bare metal.
I would rather use Assembly or compiler intrinsics instead, just like many C alternatives, some much older like NEWP, do.
Also many of the C library calls are impossible to implement in pure ANSI C without language extensions or Assembly, malloc() and free() being two of them.
- Swift code can't be called from C code yet
- Swift has a runtime, Rust does not
Swift can't do everything Rust can, but I also don't expect it to be able to.
Since this is a Swift thread, I will say that I like Swift except for the parts that are clearly there to interact with Objective C. I have no interest in doing apple os interface development but I'll be seeing how it goes as a server development language when the 3.0 preview happens in June. If Rust for all things doesn't work, core Rust + Swift scripting is the planned fallback.
> trait-based exception handling
I'm obligated to mention that Rust isn't growing an exceptions system, that RFC was just poorly named. :PGo is a wonderfully boring language. That's its technical strength and social downfall.
Rust is the anti-Go. It's an adoption cult with a good language attached.
Swift is pleasantly surprising me with its evolution and cross-platform direction.
I'd recommend Rust, Swift or Go in that order. Personally I'm most interested in Go but I don't think it's the most useful intellectual exercise or career move to learn it at the moment.
D has been going for a long time, and still needs a decent more work before I'd call it mature. Its garbage collector still has global locks around every allocation and scan. On top of that, I've had memory leaks where it turned out that some anonymous closure just wasn't being released by the garbage collector. The fix for that memory leak was giving the anonymous closure a name to eliminate the environment capture.
For that matter, the tooling around things like taking heap snapshots and profiling is rather painful -- there are no good runtime tracing solutions, and the memory profiler built into the GC breaks down allocations by type, and not by allocation site, which is generally not all that useful. Valgrind dies when I try to debug invalid memory use in C code bound to D. Symbols in the local stack frame are spotty in gdb. And, in general, debugging support could stand to be much better.
The threading library (std.concurrency) can't send objects between threads without lots of lying to the type system to make things happy: You can't send shared references by default (we've hacked around this at work, still need to upstream the patch), and you can't send unshared references unless they're immutable. Sounds ok from a safety perspective until you realize that D is built around mutable objects, and there's no way to declare a value class.
There are lots of things to like about D, but I would be very antsy about using D for a system that I had to rely on in any critical capacity, as things stand. At least, not without a willingness to commit to changing the libraries and runtime.
I haven't used Go, Swift, or Rust in production enough to have an opinion on them and their production readiness.
I work mostly with networked services though, and Rust seems to have a bit of a comparatively (vs Go, Elixir) poor concurrency/async-io story so far -- though I am sure the libraries will come eventually.
As for displacing Java - this is never going to happen - I prefer .NET but soo many companies have invested man-milenias probably in to Java deveopment - it might losr popularity, especially with Oracle at the helm.
This does not come from a Swift fanatic as I view Swift as my next Transact-SQL. A language I will do work in and become very proficient, but I'm not loving it.
I'm not too much into Rust, but sure, if you absolutely cannot have even a low latency garbage collector involved or do very low level work like drivers, I guess it is useful. As soon as I don't, I feel like the pragmatic nature of Go is very appealing. I wonder about Rust's future, where it will be in 5-10 years.
I'd prefer Swift more if stuff started happening here as for cross-platform support. I hear the Linux support isn't even quite there yet, and as for Windows, it just recently saw _any_ kind of progress. I feel like it will take a long time until Swift feels like a natural general purpose choice across the largest three operating systems, rather than an iOS / OS X development platform ported to said platforms. But sure, Swift as a language feels modern and just great. Sometimes like a merge of Rust and Go, with the similar focus on safe code of Rust from guards, optionals, seeing the good in immutability, pattern matching. I wish Swift was much more popular and with much better cross-platform support.
I have played just very little with D and it has a bit much feature creep and bad traction for my taste (community _does_ matter). It had a chance of becoming more popular before, but I can't really see it anymore with these new languages. They already seem to have overtaken it in popularity, leaving D as a used but very niche language.
[1] https://github.com/apple/swift-evolution/commit/06b69a6e51a7...
(BTW, shameless plug, I send a weekly Swift newsletter here: http://SwiftNews.co)
For example, Swift was just added to the FreeBSD ports collection (http://www.freshports.org/lang/swift)
Most of the time im writing simple and small programms (on a windows machine) that manipulate data, interact with the web, or work with files.
I really liked Swift from the start. It has all the language features that I like. Sadly, with no Windows support, and Linux being only a second class citizen, I'm not motivated enough to spend a huge amount of time with Swift.
I also hope that they provide a documentation like Go. The Swift book is fine but the examples of the Go documentation in addition to the text, the easy navigation between packages/structs, and the aility to jump to the implementation helps a lot while learning the language.