
Swift, and why it hurts you (from an GNUStep developer) - DiabloD3
http://heronsperch.blogspot.com/2014/06/swift-and-why-it-hurts-you.html
======
mamp
I'm not sure why Swift is controversial. Objective-C was all but lock in to
Apple's ecosystem. If you want cross platform there are other options. Why
shouldn't Apple try to optimise development for their ecosystem? Playgrounds
are pretty impressive, as is the interoperability with Objective C e.g.
dynamic translation between Objective C and Swift. I wish Microsoft had made
it easier to mix and match F# with C#.

Swift has some pretty nice features to improve programming safety such as
stronger static typing, type inference (not as good as functional languages),
a very nice syntax for option types, discriminated unions, pattern matching,
improved focus on immutability. It's impressive that Swift introduces all
these functional goodies without programmers having to blow a socket trying to
convert completely to pure functional programming.

For example the Intermediate Swift presentation at WWDC 14 has a pretty
elegant way to implement elements of what Scott Wlaschin calls 'railway
oriented programming' ([http://fsharpforfunandprofit.com/posts/recipe-
part2/](http://fsharpforfunandprofit.com/posts/recipe-part2/)).

As much as I love functional programming I think they've done a pretty good
job supporting Cocoa development and improving programming safety. My hope is
that Swift will be a gateway drug for FP.

~~~
Intermernet
I think the problem is that Swift has a proprietary license and Objective C
doesn't. I actually think this is likely to be the death of Swift in a
completely different way; that of community support and tooling. It's much
easier and more fun to write libraries, port to different platforms, and
optimise compilers and runtime on open platforms. Flash suffered from this
problem, Silverlight suffered from this problem, RealAudio etc. etc.

Apple should just open-source the entire language (runtime, implementation,
spec etc.) and let the community make it stronger. Seemed to work with Google
and Go!

~~~
Jtsummers
C#'s implementation was closed source and tied to a totally novel (at the
time) API suite in .NET. Swift has the advantage that it's tied to already
known APIs, and that it can call into C/ObjC code, and they can call into
Swift. At this stage it's probably too early to say whether Apple will or will
not open source their Swift implementation. Again, pointing to a successful
proprietary language, C# didn't have an open implementation until Mono came
along in 2004. And that project had to develop a lot more infrastructure. We
_just_ (I hate that word, but in this case it's not totally wrong) need a
compiler front-end for Swift. Under the hood it's using the same LLVM workflow
that clang uses. So keeping the language closed-source won't last for long
anyways.

EDIT: C# could call into C++ from the start, and I believe the reverse was
also true. So platform-wise, MS matches the Swift<->ObjC/C bridge as well. I
forgot about that detail.

~~~
ygra
C# can call C, but not C++, except for COM interfaces (which have a defined
external interface and mechanisms to get around the drawbacks of C++
libraries). To use normal C++ from C# you have to implement a bridge that's
both C++ _and_ managed code.

~~~
Jtsummers
Ah, ok. I've seen it in code bases but never had to touch those sections (and
it's not used in anything I'm developing, pure C# code for my projects).
Thanks for the info.

------
erokar
"The language is very JavaScript-like in its design..."

Disagree. JavaScript isn't even strongly typed. Swift affords many imperative
and functional techniques, but that doesn't make it JavaScript-like.

"The real purpose behind this language, however, is a little darker. I believe
that it's ultimate purpose is lock-in. The more developers start using Swift
the less they are going to be able to move to other platforms (such as
Android)."

By this logic we should all be using Java. Now ask yourself: Should we,
really?

~~~
adwn
> _By this logic we should all be using Java._

Or C. Or C++. Or Haskell. Or Python. Or Fortran. Or any other language with an
Open Source compiler.

------
kilon
If Apple really wanted to lock you in then it would not allow anything else
than Swift/Objective C in the app store for macos and ios. I have seen lisp
apps in app store, python apps, javascript apps, haskell apps, hell I have
even seen the language I use and its quite unpopular , Pharo apps.

Its true that Apple imposes limitations for its own profit and the benefit of
the users. But it does not lock in anyone.

So no Swift is no big conspiracy. Its just a move forward for Apple to attract
more developers and give android java a run for its money in terms of
performance and ease of use. Apple sends the statement "not only we are a
platform with less worries on incompatible hardware, but now we even offer a
powerful yet easy to use language". A wise move from Apple and a big plus for
developers.

------
johansch
And developing in Obj C makes it so much easier to move your code to Android?
I don't get it..

~~~
bluedino
You can write the core of the program in C/C++ and just use Obj-C to interface
with it. I imagine you will be able to do the same with Swift.

------
pixelmonkey
Will Swift be open source? That's the core question.

In the 2000's, Flash was gaining a ton of popularity on the web, and
Macromedia was recently bought by Adobe. They had just developed a new
programming language, ActionScript, which was dynamic and object-oriented and
offered an interactive developer playground. For early web developers like me,
it was seductive and simple and more powerful than other state-of-the-art web
technologies.

But, developers across the world, myself included, wondered: would
ActionScript and Flash become open source? That was the one thing holding it
back from broad adoption and improvement by the community. The web wouldn't
stand for a closed standard.

I wasn't so sure what Adobe's plans were -- so I abandoned ship. Many others
did, too. Of course, the rest is history: HTML5 technologies and JavaScript --
aided by canvas/svg/webgl and other standards -- have won the day.

My view is that openness always wins in the developer community in the long
run.

Flash is now relegated to a "second-choice" technology for web applications,
mainly used for some specialized rich internet apps, games, and backwards-
compatible video players. I personally hope that Apple learns from this lesson
and deviates from their history by making Swift free and open source software.
It's not only better for the developer community -- it's also better for
Apple.

~~~
mantrax5
ActionScript 3 was open source.

\- It was based upon ECMAScript 4.

\- The ActionScript code was open source, and the actual reference code for
ECMAScript 4.

\- The JIT runtime of ActionScript 3 was open sourced (Tamarin) and "donated"
to Mozilla to use as the basis for a faster JS runtime.

Also, your comparison of Flash with Apple's Cocoa/OS platform frankly makes no
sense. The situation is vastly different. Swift is in exactly the same
position as Objective-C. It's under no greater threat to disappear than
Objective-C is.

~~~
pixelmonkey
Oh, and importantly, the _Flash Plugin_ , the runtime, is not even open source
today. Making the tooling open source is important and good, but also tends
not to be enough.

~~~
ytch
So opensource a language maybe isn't a problem?

Regardless the openness of obj-c and swift, the iPhone runtime is still close-
sourced.

And you can write your own swift compiler in LLVM, even if apple don't
opensource it.

~~~
mantrax5
Open source is rarely the problem in the real world. But that's what you get
from people who see divide the software world in "open" and "closed".

At one point or another your software needs to run on a piece of hardware. At
least some of it won't be open, because as IBM learned in the 80s, you end up
giving your hard earned lunch to your competitors.

------
LukeB_UK
How is this getting upvotes? His main argument is that it locks you into a
certain platform. So did Objective C.

Being that a lot of people who will pick up swift will be Objective C
developers who were already locked in, I don't see the issue here.

~~~
Intermernet
You can write Objective C on Linux.

~~~
m_mueller
Yet the argument is pretty much moot since the Obj-C you write for iOS apps is
locked to iOS/OSX because of Cocoa. In that regard nothing changes for
developers of these platforms - they just have one more language choice now.

~~~
randomdata
Cocotron[1] is a reasonable open source Cocoa implementation. You could very
well aim to support both it and Cocoa proper.

Beyond UI, I actually have used my Objective-C data models from an iOS app on
Linux. There is no need for Cocoa there. Objective-C code transitions quite
well at that level.

That said, I do agree that it is really not a big deal for the vast majority
of developers.

[1] [http://www.cocotron.org](http://www.cocotron.org)

------
sigzero
Swift will not hurt you. It is a programming language and programmers are
pretty smart people.

Apple created a programming language for their platform. Use it or don't.

------
andystannard
I don't see how swift locks you in more that objective C ? I guess as its so
much more accessible and easy to step into from javascript / java / C# it
makes it more tempting to use compared to using something like Xamarin. I
don't see this as a dark ploy just Apple wanting to make themselves as
developer friendly as possible.

------
Jare
Swift locks you to Apple systems just as much as Objective C did, but the cage
is way more comfortable. Objective C was so ugly that it was a deterrent for
iOS/OSX exclusivity, whereas Swift is a plus. Also, Playbooks as a programming
teaching system is an excellent trojan horse.

All things considered, I don't think the lock in will have much legs, but

------
snoonan
The author doesn't demonstrate his case, but he's not wrong about the entire
platform. The real lock-ins remain in the form of the iOS/OS X SDKs and
services like CloudKit. A more coherent argument might be that the much easier
and more modern Swift and latest IDE features like playgrounds will make
coding for the Apple platform easier, more fun and generally lead to a
continuation of the "iPhone first" approach.

We always had to deal with different languages and different SDKs for each
platform. This just makes one of them less of a bear.

------
bedane
Fix your title : Swift, it hurts you (and I'll let the reader figure out why)

Did you seriously expect Apple to ship a cross-platform development solution ?

------
manu3569
I disagree on the locking-in argument. I mean if you decide to program for
iOS, you use Swift or Objective C, just as you would use Java to program for
Android. Does the Android community lock developers in by making you use Java?
Me thinks not.

And in the greater sense, a good developer shouldn't be defined by one
programming language, thus the locking-in argument is a bit ridiculous.

------
jcizzle
Lock-in? This argument - which we've heard before - makes the assumption that
a programmer can only know one language at a time.

I get that some folks are fearful of change. You're in the wrong industry,
then.

~~~
drdaeman
I think it's not about the programmers but about the code. Swift code is much
less portable than ObjC one.

On the other hand, I've never heard of anyone using their ObjC code from iOS
app for Android one (by transpiling to Java or building ObjC code as a native
library) or vice versa, so I guess this point is probably mostly moot. Except
for the rant comes from a GNUstep developer, where ObjC is a language of
choice, too (and Swift is supposedly unavailable, at least it's the case at
the moment).

------
asveikau
The folks saying they don't see how it's lock in any more than objc need to
think harder about what GNUstep is and what it means for the objc community.
People already think of it as "Apple's language" and it's true that the vast
majority of developments come from there, but I believe it to be more than
that thanks to GNUstep.

When I learned objc more than a decade ago I was really just a kid, I could
not afford a Mac or any extra hardware. But there was a GNU compiler. GNUstep
had an open implementation of Foundation and AppKit. And the whole thing ran
on Linux. So I was able to play with it. When I share this story with current
objc devs, they give me blank looks. Mentally, they have already decided it is
Apple's language and nothing more. I believe this is a form of blindness to
the potential of objc. Why not objc on Linux? It exists today.

Hopefully Apple opens up the compiler, people port it to GNUstep, and the
whole issue is moot.

~~~
pjmlp
It is too outdated.

------
Nekorosu
The author lost me on "the language is very javascript like". His view on
programming languages design is highly superficial. I can't take seriously the
rest of his thoughts.

~~~
cmiller1
Seriously, does his extent of looking at the language end at the "var"
keyword?!?

~~~
randall
Semi-colons too, natch. :)

------
tomelders
I once worked in marketing for a big fashion brand. At the time, there were
all kinds of reports about how manipulative and sneaky the marketing
strategies of this company were, and how we employed all kinds of
physiological trickery to make people but our stuff.

In reality, it's was a bunch of people batting around ideas in the hope we
would come up with something that would make people like our products.

So I have a hard time believing someone at apple asked for a programming
language that would "lock in" developers.

~~~
a-nikolaev
Since open source is practically standard in programming language design
nowdays, it is almost definitely Apple's intentional choice to make Swift
closed. Also, they could take an existing open source language that is in the
same category (OCaml(F#), Rust, Nimrod, Haxe ?). Being closed, prevents
developers from cross compiling Swift for Android, and it will make almost
impossible to write an alternative Swift compiler from scratch, since the
language is not standatdized.

------
Quequau
I'm confused... there is no explanation about "why" Swift might hurt.

------
andybak
Do we even know what license Swift is under yet? I thought we were still
waiting for the definitive word from Apple.

I'd be very surprised if it turned out to be under a non-open license and
would see it as a hostile move by Apple. If that was the case then I too would
be rooting for it to whither and die.

------
bryanlarsen
I doubt that this is going to be a problem for long -- I'm willing to bet that
at least two projects have started to create open source Swift compilers.

IMO, Swift is the most interesting language that's obviously going to be
around and popular in 10 years time. There are languages that could be argued
as even more interesting, such as Rust, and languages that are even more
obviously going to be around and popular in 10 years (C++, etc), but swift is
the only language I see that has both.

An open source Swift will not make iOS apps much easier to port, though. The
libraries and frameworks of iOS are a much bigger hurdle than the language.
Not to mention the fact that there will probably be small incompatibilities
between the Apple and the open source implementations for at least the first
few years.

------
alexchamberlain
This assumes no one will write an OSS compiler...

------
shadesandcolour
We have no idea how this is different than Objective C. When was GNUStep first
released? How much time was there between Cocoa being released and GNUStep
being released? Swift has been out in the wild for a total of four days, there
is no telling whether it will be open source yet. No one has made commitments
one way or the other.

------
yardie
Guys, you're completely screwed because we're writing on patent encumbered
languages, on patent encumbered OSes, using patent encumbered hardware, with
patent encumbered processors, that were manufactured in patent encumbered
processes.

It's turtles all the way down!

------
pjmlp
Objective-C is also Apple only, as coding is much more than just the language.

GNUStep was interesting back in the late 90's. Nowadays it is just a
curiosity, with NeXTStep compliance still catching up and Cocoa support around
Mac OS X 10.6.

------
thehme
The author is completely right. When Apple announced that it will allow
families to share music, books, etc., the first thing that came to my mind
was: "Apple is trying to lock us in." I can already share my music, perhaps
because I know how to do it, even if it is a tedious process, but I can see
how this would keep users with Apple, if they don't know any better. Then they
talked about swift and did not confirm it will be Open Source, so this also
was a red flag for me that they are trying to further lock-down. When I think
about it, this is how Apple became profitable and big, so it makes sense that
it is looking for ways to stay in control, even if it alienates some.

~~~
ytch
But even Swift is lake of portability, so is Objective C. For example, It is
hard to port iOS project in Objective C to android. So I think Swift doesn't
change anything?

~~~
thehme
According to some articles while "there are many tools available to port
Objective-C to Java i.e port an app from iOS to Android...porting Swift apps
to Android will now become a tough task for developers."

[http://thehackernews.com/2014/06/apples-new-swift-
programmin...](http://thehackernews.com/2014/06/apples-new-swift-programming-
language.html)

