59 comments

[ 2.9 ms ] story [ 116 ms ] thread
And developing in Obj C makes it so much easier to move your code to Android? I don't get it..
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.
"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?

> 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.

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 ?

I'm confused... there is no explanation about "why" Swift might hurt.
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/).

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.

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!

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.

Indeed, source code availability of the compiler implementation and accompanying infrastructure doesn't really matter. It takes time but it could be re-implemented from specs.

The problem with C# and .NET is (was) that they are patent-encumbered and that's the real game stopper. It took quite a long time and a lot of debate on .NET suitability for a Free Software movement to settle that matters somehow (recent releases under Apache license seem to fix many issues, though, although that still needs a statement from FSF's lawyers).

I'm unaware about Swift relationship to software patents. Does anyone know?

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.
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.
If you're arguing that C# succeeded despite not being open source, consider that Microsoft's tools at the time were EOL'd, so transition was forced for MS tech users.
What do you think the 'community' would do that Apple isn't able to? Languages are not meant to be designed by committee.
Apple can retain the core design decisions (like the Linux kernel) but the code should be open to pull requests and design improvements.

To use Go as an example, the entire Windows port was done outside of the core team, and is now a supported platform. The same goes for ARM, PPC64 etc. Also, huge performance improvements in core features such as channels were implemented by non Google employees.

If Apple open Swift, it can find hold in all sorts of niches they didn't expect it to, and can benefit from an entire community of developers who can fix the language's problems rather than be frustrated by them.

(comment deleted)
GNUStep's Objective-C framework makes it easy to port desktop apps written in Obj-C over to other systems, and includes newer features like ARC, so I wouldn't say Obj-C locks you into AppleLand at all, at least for desktop apps.

From a slightly different angle, I personally think Obj-C is a very neat alternative to C++, and that it would flourish outside of the context of Apple's frameworks if more folks started to use it as such. While I'm happy that iOS development will be a little less difficult now thanks to Swift, it makes me sad to think that Obj-C might not get as much attention from newer developers who like the way the language extends C with Smalltalk-style OO and message passing.

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.
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.

(comment deleted)
Your answer appears to be for another post; here the post is about Swift being closed-source and tight to the Apple ecosystem, not about being compared to another language.
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.

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.

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.

You can write Objective C on Linux.
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.
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

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.

Flash dominated the Web more than Internet Explorer (even at IE's pinnacle). Somewhere in the mid 90% of visitors had Flash installed at it's peak.

Open standards did not beat Flash. A bigger proprietary platform bully sent Flash to it's doom - Apple's iOS. Adobe's Flash was vulnerable because it had to seek Apple's blessing to be part of Apple's platform, and they were spurned.

This is the lesson of being a sharecropper - even a massive proprietary-source company, Adobe, are powerless when the platform owner enforces it's control. https://www.tbray.org/ongoing/When/200x/2003/07/12/WebsThePl...

Yes, open standards win in the long run, after Apple have profited significantly from the closed approach they are taking now. At which point it's a meaningless victory.

The point of the article is, be aware you are just a sharecropper, and working on Apple's lands for as long as it's in Apple's interest. And Apple owes you nothing for all your hard efforts, it will change the environment for it's own corporate interests. And you, the developer, are mere insignificant collateral damage. Remember that Steve Jobs killed Flash. And there was nothing Adobe could do to avoid or mitigate it.

Current iOS developers have already accepted this, willingly or unknowingly. It's the new folk who are attracted by the new shiny thing, need to be aware of the consequences of working on an Apple controlled platform.

Flash was already in decline before iOS had a significant impact on it. It was in decline for the same reasons Apple did not allow it on iOS: poor UI, terrible performance, and huge energy usage.

Both WebOS and Android had every intention of using Flash as a feature to differentiate themselves from Apple. If it were a matter of sheer marketshare, that should have been enough--Android has more customers than iOS.

But Adobe could never deliver a Flash runtime with acceptable performance, and even Android does not ship it anymore. Apple did not force them to drop it; it just wasn't good enough.

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.

ActionScript 3 was released in 2006, long after developers had already started departing the Flash ecosystem in droves and Flash fell out of favor as delivery technique for web applications. "Ajax", as we were calling it then, started to be used as the primary delivery technique for rich applications; the original Ajax essay came out in 2005 (http://www.adaptivepath.com/ideas/ajax-new-approach-web-appl...) and that's when we started reverse-engineering applications like Google Maps to build interactivity without proprietary plugins and languages.
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.
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.

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.

Until the iPhone came, I've a seen lot of attempts to :

- move Java to a more browser friendly position

- make Flash lighter, faster and easier to integrate on mobile

These were for feature phones, and any of the above were realistic and plausible (I did actual projects using each of the above)

Flash got killed because it was too mouse centric and there would be no bridge between mobile and desktop, thus denying any network effect fom the desktop. The API was good enough, there was a few open source compilers and the runtime was OK. Compared to native Java it was actually nice to use.

But when you see the iPhone or the android phones, there is no compelling reason to do a lightweight Flash app when the same can be done in JS for more or less the same effort (and the js would work everywhere). Access to native functions could have been a selling point, but even that, going the full native route would be more sensible.

TLDR;for me Flash was killed by js coming to mobile, more than anything else

AS3 was based in ES4 specification,"superseeded" by ES5.So ActionScript was in fact pretty opened and could have been today's javascript.

I dont think one can compare AS3 and Swift. In fact Microsoft had it's own implementation of ES4, Jscript.net.

> Flash is now relegated to a "second-choice" technology for web applications,

"Thanks to" Steve Jobs,that didnt want anyhting on his plateform he couldnt control.

IOs is a closed ecosystem,IOs has more developpers and apps than ever.There is nothing to learn here but the fact that they control their plateform,from end 2 end,and users keep on coming.

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

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.
Seriously, does his extent of looking at the language end at the "var" keyword?!?
Semi-colons too, natch. :)
Reading through the description, plus looking at some example code reminded me a little of javascript (particularly in its es6 incarnation) too.
Me too but "the language is very javascript like" isn't the same as "reminded me a little of javascript". Judging the language by it's syntax is a very superficial approach and then even the syntax shows a lot of things not present in JavaScript.
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.

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).

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.

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.

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!

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.

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.
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?
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.

It is too outdated.
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.

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.

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.
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.