So it looks like the language isn't open source and won't target non-Apple runtimes?
I'm not trying to troll, I just think that it's a pity that Apple tends to limit the ecosystem and applications of its otherwise-great languages. Building against LLVM ought to make it fairly trivial to make this cross-platform.
Now that Microsoft has been open sourcing so much stuff I was expecting Apple to follow the wave and release Swift as open source too. It's a shame though.
I'm old enough to remember Apple suing Microsoft for "copying their look and feel". Open source is something Apple only does strategically - when they have to or it suits them - it is not part of the company's ethos.
> Open source is something Apple only does strategically - when they have to or it suits them - it is not part of the company's ethos.
What Fortune 500 (or even 5000) systematically open sources every piece of technology? Every company I can think of -- Yahoo, Microsoft, Google, Facebook, LinkedIn, Twitter, Amazon, LinkedIn, AOL, Craigslist, Oracle, -- selectively decides what to open source.
I'm not saying that's right or wrong, but Apple is far from alone in doing so.
Yeh, I agree. I was surprised when they open sourced webkit. But like you said, it's strategic. I don't think they care that much about the browser. Their emphasis is on apps running in their ecosystem.
Actually, WebKit was a fork of KHTML, correct, but it is licensed under the terms of LGPL. One extra letter, but a world of difference. This is why they had to open source KHTML, but they could get away with not open sourcing Safari (if KHTML was licensed under the GPL, any app that linked against the library would need to be licensed under the GPL, too.)
Let's not forget that webkit when it was released was little more then a code dump - one big patch that had to be applied to KHTML.
Also "they didn't have a choice" sort of ignores that they did have the choice of not using khtml and wouldn't have, if its license could've been problematic for them.
thanks for this. I clicked their link(on my less than a year old ~$2000 MBP) and it opened iBooks and sat there with a loading icon for minutes. My first and last experience opening iBooks.
Well if the core of the language is licensed and closed source (is it?) and they do not make a standard iso, it's really problematic to reimplement it in another platform. Both from a legal that from a technical pov.
The book is ePub with no DRM. You don't need an apple device. You could download it on iTunes on windows, and read it with any ePub reader. if you don't want to install itunes i guess you could get a friend to email you a copy.
Open source or not, Swift will never be appealing for the world outside Apple's garden if it will be as intertwined with Cocoa as Objective-C currently is. It will be nice however to see how well Swift could be ported to Android.
There's no indications yet that it won't be. I suspect a large part of it will be part of a timed-release with their next merge to LLVM. But only Apple knows for sure.
I'm impressed that it looks like they're turning Bret Victor's demo into a reality with playground. Check out his demo if you haven't: https://www.youtube.com/watch?v=PUv66718DII
Really, really interested and excited about learning Swift.
Wouldn't say I'm impressed but definitely really excited. BVictor is pretty amazing. Anyone who hasn't seen should check out either these talks. There're great for getting extra inspired about coding or the coding life, and great for perspective too:
Why would they "pick up on" it? That was almost two years after Bret left Apple and it's been another two years since. At this point these ideas are as available to anyone as they are to Apple.
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";
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.
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!
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
I think they just don't care. Swift-lang looks to be completely different when you look at the examples[1]. Its syntax is more java-y then Apple's iteration.
Also Swift-lang is Apache 2.0 licensed, which I have a feeling Apple wouldn't use as a base for a new language.
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.
"The debugging console in Xcode includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment. Available from within the Xcode console, or in Terminal."
Does this mean that we can use the Swift REPL in the Xcode debugger to explore running ObjC programs? That would be enormous fun, not to mention very powerful.
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.
Apple has a mixed history with the openness of their tech. It could be that the only place you'll be able to run the language is on an iOS device. We'll see.
println("\(possibleNumber) could not be converted to an integer")
}”
Nice to see the Apple's language developers embracing functional programming by providing a clean implementation of the Maybe Monad as well as support for closures.
I love this feature, but it's not quite the Maybe Monad, which lets you assemble a sequence of (possibly failing) statements together, and fail the whole sequence if any of the parts fails (without if-statements or switching of any kind).
I don't think this is very functional. First of all, the let binding inside the condition has type bool by itself (instead of the normal let-in construction). Also, it's scope permeates into the body of the if condition. The whole thing is very much like C-style NULL/Not-NULL check:
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.
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.
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.
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.
About time! Objective-C is increasingly becoming inadequate for Apple software development. Apple knew that. They finally decided to do something about it. If it goes popular the same as Microsoft C#, that would be a huge win for both Apple and developers.
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.
Couldn't help to think about Greenspuns tenth rule[0] when I saw the release of Swift. Even though it's kind of neat with the REPL and at a first look xcode looks promising.
Why doesn't Apple try to make easier to learn and easier to use programming languages instead of focus on the more difficult ones like Objective-C?
Why not use BASIC, Python, Ruby on Rails, Java, or even Pascal for their new language so you get more people to become developers and make iOS and OSX apps in greater numbers because it is easier?
Made a tool to convert Winforms to Cocoa Forms to port some Visual Studio C# and Visual BASIC apps to iOS and OSX, and win over the Windows-Only developers to the Apple platforms?
This Swift language seems so hard to learn, almost like F# or something. Not as hard as Haskell, but for the average developer it is going to be painful to learn.
It does. We probably changed the url of the other thread; I don't remember (there have been so many), but we usually add a comment indicating what we did.
On the other hand, the duplicate detector is also quite porous—in most cases a slightly different URL will get through. That's by design: we want the best stories to have multiple cracks at the bat. It's easy to abuse, of course, so we ask people not to abuse it. A small number of reposts is ok.
Guys, I'm not sure if anybody's noticed yet, but call it a co-incident or what(make the "what" "copy"), but, another programming language with near similar features already exists, though its not C based and some other stuff is quite different but, yeah, see this : http://www.linux.com/news/featured-blogs/200-libby-clark/725...
I can't find anything in the book or on the website about concurrency. I'm not familiar with the Apple programming ecosystem, how is concurrency handled? Is the lack of language-level support a concern or is everything shuffled off into libraries and the runtime?
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...
How difficult would it be to have that playground preview for other langs? Im willing to bet there is someone building a sublime extension right this minute
Haven't had a chance to look at the docs for it yet, but will LLVM be the compiler for it and will it support compiling Swift into its native bytecode?
> Using the high-performance LLVM compiler, Swift code is transformed into optimized native code, tuned to get the most out of modern Mac, iPhone, and iPad hardware.
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.
This is truly a game changer for me. Finally, I can develop for ios/osx without the excruciating pain and torture of working with the antiquated and ugly syntax of obj-c.
"Swift eliminates entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically."
I'm not trying to troll, I just think that it's a pity that Apple tends to limit the ecosystem and applications of its otherwise-great languages. Building against LLVM ought to make it fairly trivial to make this cross-platform.