231 comments

[ 4.7 ms ] story [ 222 ms ] thread
So they copied this idea for the IDE?

http://www.lighttable.com

Well, LightTable was inspired by Bret Victor's ideas. He worked at Apple earlier.
Seems a lot more like a call back to the Smalltalk roots of Objective-C.
I cannot be any happier that they did.
Was my very first thought, too. The next thought was Bret Victor. Yeah.
Looks like C# with .NET Native, some sort of.

Playground is interesting.

Minus awesome IDE with automated refactoring.
Looks a lot like golang meets haskell:

func makeIncrementer() -> (Int -> Int)

EDIT: Why the downvotes? was just an observation not a criticism. Looking forward to using it instead of Objective-C.

Looks like they pulled a Golang: http://swift-lang.org
You do realise that link is completely unrelated to what Apple is doing, right?

EDIT: Nevermind, my mistake. I thought the comment was about Apple was making their own language like Google did with Go, not Go! already existing as a language

Yeah, that's the point. There's already a programming language called Swift but Apple is using the name anyway.
That's precisely his point. There was already a pre-existing (but little-known) language called Go when Google announced theirs.
Gotcha, my mistake. I thought the point was Apple was making their own language like Google did with Go and he was just linking the wrong language.
They do include a link to the other swift at the bottom of the page:

> Looking for the Swift parallel scripting language? Please visit http://swift-lang.org

Anyone else notice the similarities in their logos as well?
> Looking for the Swift parallel scripting language? Please visit http://swift-lang.org

Did they not know or do they just not care?

(comment deleted)
I think the lawyers decided that they didn't need to care...
They have enough money to not care because they can cover the cost of the worst case scenario.
Looks like they took inspiration for the icon also. Look at the second to last icon on that page.
more likely both icons were inspired by the bird's distinctive silhouette
I hate to admit, but dumb me didn't realize this was a bird. I thought swift as in quick.
"Change your apps name. Not that big of a deal."

--Steve Jobs

There seems to be a tradition in corporate programming languages to reuse the name of a somewhat obscure existing language. Google called their language "Go" despite there being already a language called that as well.
Really excited and surprised by this announcement. Anyone know the provenance of this language? Who built it, what are its intellectual roots?
Well, Chris Lattner is involved at the very least, which is a good sign.
swift-lang.org mentioned at the bottom of the page seems to be down.
It's an unrelated language that is being hammered by all the people Googling "swift programming language"
Looks like Recruiters will now be seeking Swift Developers with at least 5+ years of experience.
The Swift playground supports time travel, so this may be possible.
even i tweeted the same joke, not knowing others were doing it.

What I find more amazing is that, as humans, we have all chosen "5+ years" as the experience level in our jokes.

This will revolutionize programming education.

Interestingly enough, the time manipulation in Swift was inspired by a game called Braid (http://en.wikipedia.org/wiki/Braid_(video_game)) released back in 2009.

This will help young programmers solidify the connection between giving the computer logical commands and what is outputted on the screen immediately.

Reminds me of how excited I was when Processing (http://www.processing.org/) was released which made it dead simple to interact with a screen and graphics. Didn't have live feedback, but it made it incredible easy to understand OOP.

This will also be incredible for ease-of-setup. Install Xcode, and you're ready to go. No other dependencies.

Setting up a dev environment can be one of the big reasons people fail to learn to program.

>This will also be incredible for ease-of-setup. Install Xcode, and you're ready to go. No other dependencies.

1. Buy particularly expensive computer 2. Register as an apple developer 3. Install Xcode, and you're ready to go.

> Setting up a dev environment can be one of the big reasons people fail to learn to program.

Citation needed :)

Actually:

1. Buy a Mac mini for $600, which doesn't strike me as particularly expensive.

2. There is no step 2.

3. Download Xcode from the Mac App Store for free.

Yes, there is a step 2 at this very moment because I can't even download this version of XCode without having developer id.
How do you see it as revolutionizing programming education? I'm pretty ignorant in this area, but it seems like a very high level language that abstracts a ton of stuff - and very platform specific too if I'm not mistaken. Is that really where we want people to start? I would have thought either a highly graphical language with buttons and widgets for early education, then moving onto platform-agnostic stuff like java and obj c would be the thing to do. Maybe you're talking about later stuff, college and beyond, which makes sense - at that point specialization to this extent seems like a good idea. But as I said, I'm pretty out of touch.
Swift doesn't look more high level than other scripting languages, but higher level than Obj-C yes, but also much more modern with a good toolset which will probably boost dev productivity.
Live preview. Kids changing a value and seeing their widget move differently or change colour instantly, that can be magical.
I work with someone who previously was a college professor teaching computer science. The university decided to standardize on Mac and iOS hardware, and teach how to program iOS apps as a way to make the CS program more popular.

Trouble was, teaching the entire XCode and Objective C tool chain was not a particularly easy entry point for learning how to develop programs.

(Maybe there were other prerequisite programs, but still, you need to understand C to really understand why a lot of things are the way they are in Objective C, in addition to message passing and object orientation, pointers, and other quirky stuff in order to really wrap your head around iOS development.)

Swift and the corresponding tools look like they would have been a godsend for teaching that class. A more practical way to get students started writing programs they can actually run on their phone.

(comment deleted)
> This will revolutionize programming education.

It could, if it were open and not limited to iOS/OSX.

A lot of schools have iPads, I suspect a few may end up buying Mac Minis.
Still on an Objective-C runtime, so it's hard to see how the performance gains they claim are achievable, but otherwise having an interpreted version should be good for productivity.
Correct me if i'm wrong, but Swift has static typing (with type inference, but still with a strict type on every variable), whereas Objective C has dynamic typing with optional type annotations. Having ubiquitous strong type information available should make it much easier to generate fast code.
Hm, maybe that's it. I thought typing was still dynamic because of the multiple return types.
guessing multiple return types are supported by just returning a tuple?
maybe it is accompanied by improvements in LLVM? Or optimizations in LLVM that are more feasible with Swift (it has immutable values).
(comment deleted)
Ugh, none of the links work. :( Can't get the ibook, can't view the "guides and reference", can't download xcode 6 beta.
xcode 6 beta d/l seems to be working fine now.. super slow, but working
It seems like the only way to view the programming language documentation is on iBooks on an iOS device? For a programming book, this is ridiculous.

Edit: The latest version of OS X does support iBooks. Lets hope you have that.

iBooks app is also available on the Mac. As the language is Mac and iOS specific it's not all that crazy.
hah, it seems iBooks is only available on Mavericks. Rather frustrating when I just want to read the documentation.
Ah, that is dumb. They're bound to put a PDF on the dev centre when it's back online.
Given you will require Mavericks or Yosemite run Xcode 6 and code with it, that makes for a sort of consistency, despite the frustrating closed-ness.
Seems fine for a book intended to teach OSX/iOS dev.
Well, you can always just open it with a zip program (e.g. WinZip on Window) if you're desperate enough.
Yeah, and iBooks on iOS requires iOS 7. If someone figures out how to get a usable standard ebook file out of this please let me know.
You can update iBooks on iOS 4.3.something to a version that'll read the Swift manual. I'm reading it on my iPad 1 right now.
It's really kind of amazing just how locked down the apple ecosystem is. Not only have they eschewed the general trend toward more open and cross-platform languages, they've even made the documentation single-platform. That's just wild.
Feels like they looked at a bunch of programming languages, took all their favorite features, and then put them into one which still sits on top of the ObjC runtime. And then added some Apple syntactic craziness.

For example:

var apples = 3; // mutable

let oranges = 5; // immutable

let summary = "I have \(apples) apples and \(oranges) oranges";

(comment deleted)
I don't get what you don't get. What's strange here?
Using the backslash+parens for interpolation is really clever! No more ambiguity like when using % or {}. Is that a Swift original syntax?
I think it makes it harder to read interpolated strings, I'm just so used to seeing % and {}.
You say "Apple syntactic craziness", but "var" is identical to JS, et. al. and "let" is identical to ML, et. al.

The string interpolation syntax is unique, but kind of makes since given then \ is the escape character in C strings.

And "let" will have a totally different meaning in ES6. It's a bit weird to use a keyword from some language with the same meaning, and another keyword from the same language but with a totally different meaning.
var and let were referring to ripping off other languages and the syntax you pointed out as unique is the syntactic craziness.
the typing system seems to be from ecmascript as well

var distance:Double = 70.0

Alternative viewpoint based purely on your three lines (I can't seem to get to the reference manual...) - all of those seem like pretty good design decisions. To me, "var" sounds like it makes something that is variable and "let" sounds like it is creating an equivalence. The "\(foo)" syntax actually looks really clean to me, though I can't recall having seen anyone use it for that before.
The language itself isn't radically different from most mainstream Algol style languages. That's good because it makes it pretty easy to pick up. In addition to what you mention on variables vs constants, the only feature which is nice seems to switch-cases.

a. No fall through. This is a plus in avoiding bugs. This is minus if you really know what you are doing and want fall throughs b. Pattern Matching in case statements. This is bit interesting and should take care of the previous case.

Other than that my first impression is it's a mishmash of various programming languages. Everything else that they demo'ed seem to be features of XCode (rewinds, variable lifetype analysis etc..) rather than the language itself.

From the manual: “Execution doesn’t continue to the next case, so there is no need to explicitly break out of the switch at the end of each case’s code.” I bet I know when that became a priority!
That should actually be 'no implicit fallthrough'. You get fallthrough with the fallthrough keyword.
A quick scan of the ebook has a pretty nice looking collection of stuff: option type, generics, protocols, etc.

A bit of python looking stuff and some ruby looking stuff in there too. I am intrigued enough to give it a try when it is available.

(comment deleted)
The Swift lang syntax looks like a mixture of JS 6, Go and Object-C/Smalltalk - at least from the first sight.
I'm super excited about this. I love Objective-C but I also enjoy all the nice features of a high-level language.
Does this means that they're ditching Objective-C?
No. Swift works along side Objective-C. You can use both in the same project.
That'a also Microsoft said about VB.NET when they introduced C# in early 2000. Now C# is a much more dominant language than VB.NET. It's a matter of adaptation . Something it take a long time. But seriously, how could Apple introduce a new programming language that would be possibly worse than objective-C to master? I don't think so if it's not light years better than OC. Perhaps better is a relative term, but from the syntax, new Swift definitely has a modern objective language feel, and should pose much less learning curve to newcomers. That's certainly a welcome sign.
Strangely I'm one of the people that loves the objc syntax. It's very verbose but that also makes it very simple to understand. Same goes for nested square brackets, they make it pretty simple to see how things are working. I'll definitely be trying Swift though.
I wonder if this brings us one step closer to developing on iOS...
This is completely unrelated to Swift, the Jabber IM app (and lib): https://swift.im/

Edit: I pointed this out as I'm curious about trademark/logo clash.

Complete history of variable state over execution time of a program is AWESOME!
Feels like dynamic languages coupled with some smalltalk resemblance, plus the playground which is kind like Mathematica? Looks pretty awesome! I'd itchy to try it out...
A quick glance through the book - looks like a nice language, certainly better than some of the stuff we use day to day.