Implementing parts of the Swift compiler in Swift
forums.swift.org
forums.swift.org
Or at least make sure new versions can be built with the previous (Rust-style), and not require downloading new binaries for every release (looking at you, Mono).
See Ken Thompsons now-infamous "reflections on trusting trust" and https://bootstrappable.org for why this is important.
(I may come off a bit grumpy from recently trying to port old versions of JDK and GHC to a newer toolchain; yet consider myself lucky to have the privilege).
Is this even relevant? For using a newer Swift with Xcode I'm forced to upgrade the OS anyway. Xcode absolutely refuses to be installed on previous OSes. Can you sensibly develop in Swift with anything else besides Xcode?
kinda. I bring a throwaway laptop most everywhere which is enough to build swift packages and test using LSP-based IDE.
Can you sensibly develop in Swift with anything else besides Xcode?
Kinda, you can install Swift Playgrounds on an iPad or Mac and develop apps with it. Not as powerful as Xcode, but you can use it.JetBrains makes a fully-featured IDE for Objective-C and Swift. https://www.jetbrains.com/objc/
[0] https://developer.apple.com/tutorials/swiftui/creating-a-mac...
I can't recall why it's necessary, but the first step in our developer onboarding README is "Install XCode, even though we don't use it"
FWIW our team has found JetBrains pretty fantastic for Swift. An important caveat of that being that we make a database product that runs on linux -- not a MacOS / iOS app that would benefit from all the special features of XCode. My guess is if that's your jam, XCode is the only high-productivity game in town.
Source: I do most of my swift development, including iOS and macOS dev, in a terminal. Editing with vim and using the swift command for the rest. You can even launch your iOS emulators and such from your command line while you're developing.
Until then, it seems too impractical. I’m not sure who their dev audience is, but it’s surely not aimed at people like me.
It is quite usable with SwiftPM or Bazel on Linux. And SwiftPM can also generate static binaries (packaged everything on Swift side up until Glibc).
VS Code extension support is passable.
It appeals to works between Rust and Python (i.e. application focused work that the default running speed is a plus not a requirement, also want to spend less time to think about object lifetime, more to think about the business logic).
If you `apt install swift` you get some object store tool.
Objective-C also has been available on Linux for about 25 years now, and it has hardly mattered.
Because they need it?
Apple discontinued macOS server, i bet they use Linux in some of their servers
All their networking related libs are available and tested for Linux [1, 2, 3]
Let's not forget that they package Swift for Linux, and now also for Windows [4]
Swift is a cross-platform language (you not wanting to understand it doesn't change this fact), it's not a macOS framework
[1] - https://github.com/apple/swift-nio
[2] - https://github.com/apple/swift-protobuf/blob/main/.github/wo...
[3] - https://github.com/apple/swift-distributed-actors/search?q=l...
[4] - https://forums.swift.org/t/announcing-swift-5-6-2-for-linux-...
Most of the work on Linux and Windows isn't made by Apple employees.
History tells us that it is not a good idea ;)
And your statement is not true at all, look at the commit history
Heck even C was fully owned by a company until UNIX V6 happened.
.net would have been dead without the community driven mono effort
C "was", it would have been dead if it was still
Notice the pattern?
No one in the .NET world cared about mono, and if they hadn't be bought from Microsoft, they would already be doing something else, it isn't as if Xamarin and Unity were making them rich.
C only got adopted, because companies got into commercial UNIX workstations and it came with them, on the base install. Until Sun introduced the concept of UNIX user and developer editions, no one cared GCC existed.
Notice the pattern?
Did the community or external contributors implement generics into the language or did they wait for years for the core developers at Google to do it?
Was WASM support a community driven effort from design to implementation or was it the core developers that did all the work?
It appears that 99.99% of the work and proposals have been implemented by the core developer team at Google.
Swift works great on Linux. You can install it manually, or use the official docker image. I prefer using docker and have had a great experience (both developing and deploying).
This needs to be solved on Swift side. Rust had the same problem, and until it was fixed, Rust wasn't packaged by Linux distributions either. (I know this because I helped ensuring Rust's ability to compile against system LLVM.)
Swift is nifty but still not Cpp I guess.
I'd be interested to hear if there is any large scale Swift usage outside of the Apple ecosystem.
If you are targeting Apple devices, was your performance sensitive code always written in Cpp or did you leave Objective-C for Swift+Cpp? Or, were the Cpp parts inherited and just wrapped with whatever your platform's encouraged language was?
(I used to do contract iOS work but I stopped around the time Swift came out due to taking a rewarding full-time job, so I never really spent much time on Swift beyond "huh, neat")
Behind the scenes we compile Swift to WASM and deploy to Fastly's edge network, Compute@Edge. At my day job we are using this in production and serving thousands of requests per second on our Swift app. Overall it's a lot of fun to deploy Swift on server, but the developer UX still leaves a lot to be desired. Running and testing locally is still non-trivial.
One tangential question: do you worry about using "Swift", which I assume is an Apple trademark, in the name of your product?
And short answer - Yes.
My guess is it's a matter of 'when' I have to deal with this. I've had the domain for a while, and this is something I've wanted to build for such a long time. Things fell into place when I was able to build a Swift SDK for Fastly's platform back in January this year. The stubborn engineer in me went ahead and used the domain anyway and launched what you see today.
A lot of friends at FAANGs are still working in ObjC codebases, and probably gonna skip the whole Swift story by jumping straight to Rust when the time comes.
But of course this could be just in my bubble...
Funny, the place I don't like using Swift is its main use case, high-level iPhone apps. It's overkill. The complex Stackoverflow answers for "how to do (simple thing like getting a substring) in Swift" say so.
No UI or product team is going to use Rust over Swift (or Kotlin) or whatever your stack currently depends on.
App developers use the Objective-C and Swift userspace libraries.
The newly released header only library for Metal in C++, is a poor man's binding, that wraps the C API of the Objective-C runtime, without the Metal frameworks written in a mix of Swift and Objective-C.
I assume folks are familiar with the downsides of Swift on Linux so I’ll focus on what we like about it:
- Fantastic type system
- Good language extensibility (we use Swift to build ourselves a framework to develop Steamship more easily)
- Good LLVM extensibility
- Mostly performant
- Compiled
All in all, we're very happy with the choice. My biggest gripe is slow build & test times in GitHub actions.
If Swift developers are out there and wanting to dig into more systems-style development, I'm happy to chat.
We have written a few shortcut libraries ourselves, but we actually don't end up writing a great deal of string processing code in practice because most of our operations are expressed in a higher level query language that gets compiled down to lower-level operator implementations (which only get written once).
The vast majority of our code (maybe like a lot of systems?) ends up being more about the management of the broader data & processing environment that coordinates everything.
I assume that means "efficient at runtime" - but by what metrics? CPU time? Memory usage? Power usage? Latency/responsiveness? Throughput?
What are you comparing it against?
> slow build & test times in GitHub actions
What is the cause of this? Is the generated code slow or just the compiler?
Not OP, but coming from Python, I find it is liberating to say: I need to write a for-loop for things, and it is OK, not going to be the most efficient thing, but it won't slow me down 1000x and become the major bottleneck. That has been said, Julia probably do the same thing.
Now it feels almost like writing Python, only with a real type system and not slow.
Because I stopped using it, I don’t know how much the language changed and how it compares with go/rust in terms of performance, I would bet that it is bear go performance at least, knowing Apple seems to care about it.