
When Can I Code Swift on the Server? - bluedevil2k
https://www.cabforward.com/can-code-swift-server-side/
======
matthewmacleod
_Apple’s desire to provide open source products (none)_

This trope drives me nuts. Go here:
[http://www.opensource.apple.com](http://www.opensource.apple.com)

You'll find a bunch of open-source projects that Apple has contributed code to
(LLVM, WebKit, CUPS), as well as a bunch that they wrote and released
(launchd, clang). They've recently released their ARM64 backend for LLVM.

I will be surprised—extremely so—if Apple choose not to open-source Swift. It
has no downsides for them, and it's obvious that many people will simply
refuse to get involved with it if they don't.

~~~
tptacek
Apple hasn't so much contributed to LLVM and Webkit as fundamentally enabled
them, right? Chris Lattner is an engineering lead at Apple, for instance.

I agree with your prediction about Swift being open sourced. Among other
things: as nice as Swift might be, its #1 value proposition is "easy to build
iOS applications in", so the more people using it the bigger the developer
base for iOS becomes. I can't see the downside to opening it.

That doesn't, however, mean they'll open it up on HN's preferred schedule.

~~~
chc
Lattner created LLVM before joining Apple. Apple hired him _for_ LLVM.

~~~
tptacek
... and then massively invested in LLVM.

~~~
chc
Certainly true, but what I'm getting at is, the decision not to close up an
open-source project is rather different than the decision to open up a closed-
source project. I'm not saying Apple has never contributed to open-source, but
that I don't think their decision to heavily support an existing open-source
project really reflects on what they'll do with Swift.

------
roberthahn
Wow, the OP loves jumping to conclusions. I've seen on HN a couple of threads
where people claim that Apple employees say they, at a minimum, need to clean
up the codebase first before open sourcing the language. While I don't know if
that's true, I'm prepared to wait until Apple, not this guy, says that Swift
will or will not be open sourced. Just because it's not open source now
doesn't mean it'll never be.

Then they point out that there are 3rd party HTTP libraries, and completely
ignore the possibility that maybe Swift might be just the thing to catalyze
the creation of a new one.

To be sure, unless you're serving from an OS X based server, it'll be hard to
deploy Swift-based apps until significant supporting infrastructure has been
built. But I don't see any real evidence that "never" is the answer to "When
Can I Code Swift on the Server?"

------
Arjuna
On the topic of Swift's openness, it appears to be somewhat ambiguous at this
time; that is, the door is neither entirely open or closed. For example, in
response to general questions on this topic, Chris Lattner responded:

 _" We don't have anything to say about that at this point [...]"_

[http://article.gmane.org/gmane.comp.compilers.clang.user/493](http://article.gmane.org/gmane.comp.compilers.clang.user/493)

And...

 _" Right now we are focused on finishing it up for the final release this
fall."_

[https://twitter.com/clattner_llvm/status/473907124288770050](https://twitter.com/clattner_llvm/status/473907124288770050)

~~~
mikeash
I'd give about 95% odds that Swift will be open sourced relatively soon.
That's just how Apple works at this level. They kept WebKit open source. They
adopted LLVM and kept their contributions open when they could have easily
made a closed fork. They built and open sourced clang even though there was
nothing requiring them to.

But another aspect of how Apple works is that they love secrecy and hate
making promises. They built an ARM64 backend for LLVM in private, and the
first time anyone found out it existed was when they announced the iPhone 5S
with an ARM64 CPU. They still ended up releasing the source code.

Right now, even the Swift compiler _binary_ isn't publicly available. You have
to have a paid developer membership to obtain it. They wouldn't open the
source at this stage regardless. They most likely will, but they also most
likely won't commit to anything until the initial public release.

~~~
eli
I thought they were compelled to open source WebKit since it was based on LGPL
code?

~~~
mikeash
It looks like that applies to WebCore and JavaScriptCore but not WebKit, since
that's built on top of the LGPL parts as a separate entity. From Wikipedia,
"WebKit's JavaScriptCore and WebCore components are available under the GNU
Lesser General Public License, while the rest of WebKit is available under a
BSD-style license."

~~~
Touche
So, I would say "not enough evidence" to make a call on Swift. Clang's the
only from-scratch project that was open-sourced, right? Same author though, so
I think the chances are fairly good, but how long is the bigger question.

~~~
mikeash
There have been a lot more. I give a partial list elsewhere in the thread:

[https://news.ycombinator.com/item?id=7853131](https://news.ycombinator.com/item?id=7853131)

~~~
Touche
Fair enough, good list.

~~~
mikeash
I should say that you're right about "not enough evidence". I think it's safe
to say that it's likely, but with Apple, nothing is certain until they
announce it and sometimes not even then.

------
oddevan
I wouldn't necessarily say "never." The author says Apple has no interest in
open source projects, but there is precedent with WebKit and the LLVM project.
So while no one should hold their breath waiting for Apple to open source
Swift's standard library and LLVM components, I wouldn't be surprised to see
it happen (and wait for the inevitable Rails-like framework to sprout up.
"Bullet Train" anyone?).

~~~
fred_durst
Is it possible you could give some examples of projects that were created in
house at Apple that were open sourced?

~~~
_djo_
Off the top of my head, clang, launchd, libdispatch, Bonjour (Rendezvous) and
the ARM64 backend for LLVM.

------
LinaLauneBaer
I am one of the guys behind Objective-Cloud. We will support Swift sooner than
later.

~~~
mentos
I think you guys are in a great position now to implement a server/client
solution in Swift. Effectively re-create Parse in Swift but I imagine CloudKit
may have these aspirations? Any comments on what sort of competition the
CloudKit brings to the BaaS table?

------
koblas
Sounds like an interesting case that somebody should just start a project to
add swift as a frontend to GCC - maybe a kick starter project for a grad
student. GCC has support for all of the language constructs that are present
in swift.

~~~
blktiger
Swift is built on LLVM which can compile to many targets such as Linux and
Windows. I'm not sure I see any reason to add Swift to GCC.

------
gkya
If some solution for Swift-on-the-server came out, it'll probably have to be
OS X-only; as, as far as I know Swift is OS X* only. Such a dependency on OS X
is not feasible, as OS X adds dependency to Apple hardware, rendering the
platform infinitely expensive and unportable.

I reckon that it would be the best bet for Apple to open source Swift, as it
would allow a much more lively community and a much bigger set of libraries
around the language. They need not open-source the OS X-specific libraries,
but a closed source Swift will not succeed to survive in any area other than
OS X/iOS GUI development.

* ... and iOS.

~~~
oscargrouch
Swift is a LLVM frontend, as long it does compiles source code to the LLVM-IR,
all of the LLVM "ecosystem" in the backend applies here.. so its pretty much
multiplatform by now, since LLVM compiles to virtually all platforms and
OS's..

Only Apple specific Api's wouldnt be available.. but even this.. there are
always obj-c clones here and there for the apis..

So once they release the source for the Swift frontend, the possibilities for
the Swift code are endless

~~~
chc
The Swift standard library is Cocoa. Swift might be able to compile for all
platforms through LLVM, but without the runtime and standard library, what use
is the compiled code?

------
drivingmenuts
Probably when Apple has a server product that requires it?

------
mark_l_watson
Two things:

1\. You could write an OS X application for your back end services, and use a
OS X hosting company (there are some) or use a mac mini, etc. in a colo rack.
But, you would not have a rich server side software tools infrastructure like
JBoss, Tomcat, Yesod, etc.

2\. use another language like Haskell, Java, etc. on the server.

------
fuddle
Swift on the client-side and Scala on the server-side would make for a great
combination.

------
artificialidiot
Hold my beer as I put the finishing touches on my Swift-to-node.js compiler...

------
trurl
WebObjects used to be highly regarded. I would assume that given the
Objective-C origins, Swift could use it as well?

~~~
m0nastic
WebObjects hasn't been related to Objective-C for a while (It was rewritten in
Java in 2001).

While WebObjects is still apparently being used by Apple's Online store and
presumably some other internal applications, I wouldn't expect any serious
WebObjects integration for Swift from Apple.

------
cwisecarver
Right after they launch their 64 CPU, 256 core ARM64 X-serves.

------
justin_vanw
If only we had Yet Another Dynamic Scripting Language (YADSL) that we could
use to write web frameworks! Because there are only like 17 with full
ecosystems and tools and libraries to talk to every existing database engine,
yadayadayada.

What we really need is another one so that we can spend our time poking at a
new language instead of building useful things! Swift would be an especially
good one, since it doesn't have anything new to offer (unlike Clojure or Scala
or Rust or Go) and it has great interoperability with Objective C (which Apple
abandoned for server side programming in like 2005) AND it doesn't run on
anything other than OSX, which is awesome because Apple discontinued Xserve
over 10 years ago (EDIT: Xserve discontinued a few years ago), and there are
basically no hosting providers of any kind. We could spend literally tens of
person years building up all that stuff instead of using the massive
infrastructure already in place!

~~~
matthewmacleod
What parts of Swift (a compiled, statically-typed language) make it YADSL?

~~~
justin_vanw
"Compiled" is a pretty tricky thing, even Python and Ruby are "compiled".

How about "Yet Another Syntax Without Any Interesting Semantics, With a Bonus
of Being Proprietary" (YASWAISWBBP)

~~~
chc
I don't think there is any other mainstreamish language with enforced option
types. Even Scala and F# just cave and allow nulls everywhere. Swift's
constellation of features is very interesting IMO.

~~~
justin_vanw
1\. Swift is not a mainstream language. Maybe you trust in Apple's ability to
turn it into one. 2\. Haskell and Common Lisp, but maybe those aren't
"mainstreamish".

~~~
chc
It's the primary language for a huge platform. I don't know how much more
mainstream you can get. This seems a bit like saying, "I'm not sure the newly
elected US president is a significant figure in US politics."

And no, neither Haskell nor Common Lisp are anywhere in the same city as the
mainstream. For an idea of what I mean, pick a reasonably significant "target
domain" for the language and consider how many major applications are written
in that language. There is no platform on which Haskell or Common Lisp get
used very much compared to other languages. Objective-C is clearly a dominant
presence on iOS, C# rules Windows, Java has a lock on the enterprise, C and
C++ are the bosses of systems programming, Haskell is…an interesting language
whose motto is "avoid success at all costs."

And also, I don't think Common Lisp has enforced option types. (car '(1)) is 1
while (cadr '(1)) is NIL. Am I mistaken?

