News for hackers. Stuff that matters.
Re:Swift on the Server (2020) by qalmakka on Sunday April 25, 2021 @03:26PM (#26935739)
It's 2021 and Swift is still nowhere to be found in the repositories of any of the Linux distributions I usually use. It's a big PITA to install, with nothing comparable to `rustup` or even truly universal prepackaged binaries - the official website only offers plain .tar.gzs for either Ubuntu LTS or CentOS, or source code. It's nowhere to be found on FreeBSD either, but there's a .exe for Windows.

Until they expect a novice to download and unpack random archives and set up environments without any kind of support they really can't expect to get any kind of growth on Linux. There's definitely no shortage of new, interesting languages, and too often Swift's support for non-Apple platforms feels more like an afterthought than anything.

Re:Swift on the Server (2020) by heavyset_go on Sunday April 25, 2021 @04:45PM (#26936517)
Swift had a chance 6-7 years ago when it first came out to capture mindshare on platforms other than iOS and macOS, but that chance was squandered. There's absolutely no reason someone would choose Swift over even .NET Core on other platforms these days. Thankfully, other languages have excelled during that timeframe.
Re:Swift on the Server (2020) by blario on Monday April 26, 2021 @03:39AM (#26940240)
[deleted]
Re:Swift on the Server (2020) by cygx on Monday April 26, 2021 @03:48AM (#26940285)
Re:Swift on the Server (2020) by pjmlp on Sunday April 25, 2021 @03:37PM (#26935859)
Just like Objective-C, it is a language for Apple platforms and that is about it.

Try to use GNUStep to see how much an Apple language has managed to thrive outside of the ecosystem.

Re:Swift on the Server (2020) by Apocryphon on Sunday April 25, 2021 @04:04PM (#26936114)
Objective-C at least has Oolite as a cross-platform killer app to show off.
Re:Swift on the Server (2020) by pjmlp on Monday April 26, 2021 @12:29AM (#26939242)
So much that I had to search for it.
Re:Swift on the Server (2020) by raydev on Sunday April 25, 2021 @06:08PM (#26937187)
Did Apple ever support GNUStep or make an attempt for ObjC to work on Linux in this millenium?

Because they do have people focused on maintaining Swift support for Linux. So it's a bit different.

Re:Swift on the Server (2020) by pjmlp on Monday April 26, 2021 @12:29AM (#26939241)
I wonder what those people do all day, when they just Java and Go on server side, as per job offers.

When compared with Oracle, IBM, Microsoft and Google efforts for Linux support for their ecosystems, I really cannot see they work at all, given their output in the last five years.

Re:Swift on the Server (2020) by raydev on Monday April 26, 2021 @01:29PM (#26945286)
I think they are understaffed. I know for Swift on Windows, there is exactly one person driving that effort last I checked.

The Swift Linux team might have 2-3 people. And knowing Apple, that might not be 100% of their time.

Re:Swift on the Server (2020) by pjmlp on Tuesday April 27, 2021 @05:04AM (#26953652)
Which cleary shows how much that matters to Apple.
Re:Swift on the Server (2020) by raydev on Thursday April 29, 2021 @03:42PM (#26985715)
Well, my argument is that it matters more to them than Objective-C did.
Re:Swift on the Server (2020) by linguae on Monday April 26, 2021 @04:07AM (#26940379)
I've been paying attention to the GNUstep project periodically since 2004, and I can't recall Apple ever supporting the project.
Re:Swift on the Server (2020) by slezyr on Sunday April 25, 2021 @03:43PM (#26935925)
I'm not sure that you can call this "thrive"

https://en.wikipedia.org/wiki/Category:Software_that_uses_GN...

Re:Swift on the Server (2020) by codetrotter on Sunday April 25, 2021 @04:45PM (#26936516)
That’s what they are saying, it’s not thriving.
Re:Swift on the Server (2020) by xbar on Sunday April 25, 2021 @04:39PM (#26936465)
I had similar troubles trying to find the Swift ecosystem. The author's opening statement that Swift is everywhere rang hollow, even if it might be technically not strictly false when viewed from a certain angle under the right lighting conditions.

So, I'm playing with Rust.

Re:Swift on the Server (2020) by skohan on Sunday April 25, 2021 @05:10PM (#26936724)
Same. I love programming in Swift, but deploying it is a PITA. I got tired of waiting around for the cross-platform story to improve, so I moved on to Rust. It's refreshing to use tools which feel like they're made by someone who actually wants you to use them.
Re:Swift on the Server (2020) by H_L on Sunday April 25, 2021 @06:31PM (#26937343)
Swift is absolutely an afterthought on non-Apple platforms.

Apple doesn't even provide ARM slices for the official Swift Docker images (https://hub.docker.com/_/swift?tab=tags) which makes server-side development on their own cutting-edge M1 (ARM) machines basically impossible.

Re:Swift on the Server (2020) by harikb on Sunday April 25, 2021 @03:33PM (#26935818)
+1. For non-apple usage, I would want to see lot more GitHub repos with open source support for Swift. Right now even Kotlin/Rust and others beat Swift in that respect.

I really like the language, but I don’t know what is holding it back. I wish it solved concurrency without async/await keywords - that would have been a killer feature to compete with Go

Re:Swift on the Server (2020) by saghm on Sunday April 25, 2021 @04:10PM (#26936187)
> I really like the language, but I don’t know what is holding it back

From my limited outsider perspective, it seems like Apple's unwillingness to go out of their way to support Linux is what's holding it back. There seem to be a large number of people interested in using Swift on the server, but without first-party support, Swift on Linux will always be playing catch up, as new features will always land on MacOS first and often not be designed with any regard to how they'll work on Linux.

Re:Swift on the Server (2020) by _-david-_ on Sunday April 25, 2021 @06:45PM (#26937443)
I am not sure which distros you use, but Swift is available in Fedora and EPEL (CentOS/RHEL) 8. The package name is swift-lang.
Re:Swift on the Server (2020) by WesolyKubeczek on Sunday April 25, 2021 @07:32PM (#26937745)
I can’t understand why you’re being downvoted. Unless, of course, the HN crowd doesn’t like anyone putting spikes into myths it likes to perpetuate, like “installing Swift is involved on Linux”.

Hello, it’s “dnf install -y swift-lang”, how less involved does it have to get?

“Burn the heretic! It’s involved! I’d rather curl | sudo bash things all day!”

Re:Swift on the Server (2020) by thegeekpirate on Sunday April 25, 2021 @09:21PM (#26938352)
> WesolyKubeczek

> I can’t understand why you’re being downvoted. Unless, of course, the HN crowd doesn’t like anyone putting spikes into myths it likes to perpetuate, like “installing Swift is involved on Linux”.

> Hello, it’s “dnf install -y swift-lang”, how less involved does it have to get?

> “Burn the heretic! It’s involved! I’d rather curl | sudo bash things all day!”

It seems like it's _officially_ packaged on only two distros which are relevant to Linux developers—Fedora, and NixOS https://repology.org/project/swift-lang/versions

It's also _unofficially_ packaged (aka by the community) for Arch via AUR, Slackware via SlackBuilds, and RHEL/CentOS via EPEL.

That's beyond pathetic, without even beginning to consider the resources of the company which backs them.

Take a look at how many distros Zig supports, for instance https://repology.org/project/zig/versions ...

...and Swift released the open-sourced Linux version roughly six years ago.

Re:Swift on the Server (2020) by teh_klev on Monday April 26, 2021 @07:02AM (#26941255)
The problem with EPEL is that it's not supported by Redhat, and the packages that reside there are, for want of a better phrase, ephemeral. There are no guarantees.

If you're after a long term and well supported solution then EPEL probably isn't for you. And the same goes for Fedora, which I personally use, but wouldn't run in production for anything mission critical.

Re:Swift on the Server (2020) by eecc on Sunday April 25, 2021 @05:39PM (#26936936)
To be fair, the instructions on https://swift.org/download/#using-downloads are fairly straightforward and copy-pastable.

Indeed the prominence given to pgp signature verification is a breath of fresh air compared to the current wave of pipe-shell intros: it's not gatekeeping to ask a would-be programmer to exercise some reading skills and internalize the idea of signature verification.

:)

Re:Swift on the Server (2020) by iudqnolq on Sunday April 25, 2021 @07:58PM (#26937920)
What's the point of signature verification if you get the signature and the binary from the same server? I appreciate the lack of pretenses of `curl | sudo bash`.
Re:Swift on the Server (2020) by eecc on Monday April 26, 2021 @03:04AM (#26940036)
Well, an attacker would need to first steal the private keys before they could generate the forged signatures.

So, while you could still change the public keys in the instructions and trick first-comers to install a back-doored archive, you'd still be caught in a heartbeat by everyone else who already trusted the legitimate keys (which are published via a keyserver.)

The chances and rewards of a successful, long-lasting attack are pretty slim, especially compared to those against other curl-bang installers (brew, oh-my-zsh...)

Re:Swift on the Server (2020) by herbst on Monday April 26, 2021 @06:04AM (#26940956)
Being able to install something is only half of the issue. I wouldnt touch a language for production where i have to setup my environment myself completely without package control.
Re:Swift on the Server (2020) by GoOnThenDoTell on Sunday April 25, 2021 @08:40PM (#26938156)
It kinda implies that no one writes Unix tools in swift, otherwise it would already be packaged in the disto of your choice
Re:Swift on the Server (2020) by Redoubts on Monday April 26, 2021 @07:12AM (#26941316)
Yeah though I can see people not wanting to deploy a fat runtime just to run some cli tools.
Re:Swift on the Server (2020) by whatatita on Sunday April 25, 2021 @03:28PM (#26935764)
I would hapily give it a try with a `brew install swift` but any involved install process is off putting.
Re:Swift on the Server (2020) by NobodyNada on Sunday April 25, 2021 @03:36PM (#26935857)
Homebrew requires the Xcode command-line tools, which includes the Swift toolchain. If you have `brew`, you already have Swift.
Re:Swift on the Server (2020) by iddan on Sunday April 25, 2021 @03:41PM (#26935909)
Brew exists for Linux too
Re:Swift on the Server (2020) by alrs on Sunday April 25, 2021 @04:44PM (#26936505)
if you're running brew on Linux, throw in the towel, it's over.
Re:Swift on the Server (2020) by jolux on Sunday April 25, 2021 @04:42PM (#26936489)
It does, but I’m not quite sure why you’d use it instead of apt or dnf or pacman...
Re:Swift on the Server (2020) by tgymnich on Sunday April 25, 2021 @07:03PM (#26937556)
brew lets you install packages without root/sudo.
Re:Swift on the Server (2020) by heavyset_go on Sunday April 25, 2021 @07:17PM (#26937640)
Linux distributions don't depend on running random code from GitHub repositories like Homebrew does, it has package repositories. If those package repositories are compromised, Homebrew isn't going to save you, because you won't be able to trust your system at all at that point.

If you can't trust the software you're installing, it makes much more sense to run it in unprivileged containers or VMs than relying on account-level security. If a malicious package is distributed via Homebrew, it can still do a lot of damage running as your current user, as any data or resource accessible to your user can be exploited or exfiltrated.

I tend to agree with what another HN member wrote about sudo/root and Homebrew: https://saagarjha.com/blog/2019/04/26/thoughts-on-macos-pack...

Re:Swift on the Server (2020) by rsa25519 on Sunday April 25, 2021 @07:21PM (#26937671)
> Linux distributions don't depend on running random code from GitHub repositories like Homebrew does, it has package repositories.

Is the Homebrew github repo not a package repository?

Re:Swift on the Server (2020) by heavyset_go on Sunday April 25, 2021 @07:28PM (#26937721)
Anyone can upload a Homebrew formula to Github that installs a malicious binary via brew.

Debian, for example, has trusted build systems that compile packages for their package repositories, and some packages already have reproducible builds[1].

Package repositories on Linux tend to provide the sources and binaries needed to install software. Homebrew just supplies formulas on GitHub, which only contain instructions on how to fetch and install externally hosted binaries, or instructions on how to fetch and install via externally hosted source code.

[1] https://wiki.debian.org/ReproducibleBuilds

Re:Swift on the Server (2020) by reshlo on Sunday April 25, 2021 @09:59PM (#26938507)
Homebrew has build servers that compile pre-built binaries.[1] Most of the common software that people install with it (not considering Casks) comes in this form.

It’s not the case that anyone can upload a malicious formula, either. They do review requests to update formulas.

[1] https://docs.brew.sh/Bottles

Re:Swift on the Server (2020) by iudqnolq on Sunday April 25, 2021 @08:00PM (#26937932)
There was a post today about their auto version upgrade PR bot. I don't think any distro does that.
Re:Swift on the Server (2020) by stevenhuang on Sunday April 25, 2021 @11:03PM (#26938829)
That's not a benefit, and not how it should work.
Re:Swift on the Server (2020) by arthur_sav on Monday April 26, 2021 @05:09AM (#26940669)
It's kinda ironic for such a closed company to try to create a multiplatform language.
Re:Swift on the Server (2020) by Larrikin on Monday April 26, 2021 @01:10AM (#26939411)
I like to think that Kotlin captured all the hopes that people had for swift that were dashed, but as an Android dev that loves using the language I sometimes can't tell if anyone cares for my favorite language or not.