Hacker News new | comments | show | ask | jobs | submit login

Swift on Linux, which is the key to "server side" swift, is really coming along. However, it still has several rough edges that, while they can be worked around, mar the experience and probably discourage a lot of casual tinkerers who try it.

For instance, if you download the Swift 4.1 tarball, uncompress it, and start up the REPL, it doesn't really work. The first thing you will do is probably "import Foundation" (because the Swift standard library is really minimal, so Foundation is where most of the interesting stuff is). Then the REPL will complain:

    error: repl.swift:1:8: error: missing required module 'CoreFoundation'
You'd have to hunt on the Swift bug tracker[1] to figure out that's a packaging problem on Linux, and to fix it you have to do something like:

    sudo chmod a+r /opt/swift/usr/lib/swift/CoreFoundation/*
Then, say you make a toy program, and try to debug it using lldb. That might seem to work, but as soon as you stop at a breakpoint and try to print a value, booom! lldb will spit a wall of error text at you. (This assumes your program imports Foundation, again, but almost every program will.) This is also work-aroundable, as long as you are able to find the JIRA ticket thread describing how to work around it[2].

There are a bunch of little issues like this, that make it clear that Linux isn't yet a first-class platform for Swift. All this stuff is gonna work fine on your Mac.

OTOH though, the Foundation library itself has made amazing, amazing progress. It's super useful, mostly finished[3], and its pretty clear when stuff that works on Apple platforms isn't yet ready on Linux (because those bits use NSUnimplemented() which just crashes the program). That's important because without Foundation, which contains a lot of the basic building blocks for programs, Swift won't be competing with Go or Rust.

Swift Package Manager is also fully cross-platform and awesome.

Apple also recently released an interesting low-level cross-platform asynchronous event-driven network application framework, called swift-nio[4]. This is super-interesting, but also causes more churn; for instance, once swift-nio was released, the team behind the most popular Swift web application framework, Vapor[5], started frantically rewriting their v3 release to leverage it.

So... yeah, I would say "server side Swift" is becoming less niche, but... it's still pretty niche. On Linux, it's far less mature than Go or Rust, and you need to expect to have to bing[6] a bunch of annoying little issues to get things working.

[1]: https://bugs.swift.org/browse/SR-2783

[2]: https://bugs.swift.org/browse/SR-7065

[3]: https://github.com/apple/swift-corelibs-foundation/blob/mast...

[4]: https://github.com/apple/swift-nio

[5]: https://vapor.codes

[6]: just joking! haha ;-D




Wow, super detailed. I never get anything this detailed or informative on any other type of forum. Appreciate it.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: