3 ms·
> Chris Lattner spent a year and a half creating a new programming language— That's not as bad as JavaScript, but most good languages take longer than that. S
by SideburnsOfDoom 12y ago
> Chris Lattner spent a year and a half creating a new programming language—
That's not as bad as JavaScript, but most good languages take longer than that.
Swift doesn't look bad as such to me at a quick glance, just not novel. It's a "why-bother?" language rather than a "ack, no!" language. If C# version 1 was "The Microsoft proprietary version of java" is Swift v1 "The Apple lock-in on current practices" ?
- klochner 12y agoIt's an officially sanctioned language for the apple ecosystem, meaning the bar has been lowered to "is it better than objective-c?", rather than "why bother".
- SideburnsOfDoom 12y agoWell, precisely. But there are a number of existing languages that would also be better than objective-c. And they had the benefit of pre-existing. Like with C#, a language "officially sanctioned language for the ... ecosystem" is not going to be a radical experiment, it will reflect proven wins. So it seems that apple made the decision that the benefits of rolling their own take on the current state of the art outweighed the costs associated with rolling their own.
- rsynnott 12y ago> But there are a number of existing languages that would also be better than objective-c. Which ones, exactly, would be better for Apple's purposes?
- SideburnsOfDoom 12y agoI'm not that concerned with Apple's purposes. You could pick a third of the languages on this list and improve on Obj-C: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html http://www.tiobe.com/index.php/content/paperinfo/tpci/index.... Or rust, D or go which you mentioned elsewhere. None of therm are ideal, all of them are > ObjC You could have an open ecosystem where all of them exist. That you don't is an indication of how "Apple's purposes" diverge from programmers' purposes.
- rsynnott 12y ago> You could have an open ecosystem where all of them exist. That you don't... But you do, at least for two of them (D doesn't seem to support ARM yet). Here's Rust: https://github.com/rust-lang/rust/wiki/Doc-building-for-ios https://github.com/rust-lang/rust/wiki/Doc-building-for-ios And here's Go: https://bitbucket.org/minux/goios/wiki/Home https://bitbucket.org/minux/goios/wiki/Home Or you could write your iOS app in C, or C++, or Python, or... In all cases, you'll be calling objc_send a lot, and that's the problem. A Swift class can subclass an Objective C class, and implement Objective C protocols; good luck with that in a language with an incompatible object system. Apple isn't stopping anyone from using those languages; it's just that adopting them would make very little sense; using existing APIs and third party libraries would be horrendous.
- SideburnsOfDoom 12y ago> Apple isn't stopping anyone from using those languages; it's just that adopting them would make very little sense Apple isn't stopping anyone, and Apple certainly isn't encouraging anyone from using any language that doesn't issue forth from Apple.
- Kurtz79 12y agoI don't have much experience in writing iOs apps, but the impression I always had is that the language is not nearly as important as it seems, to that end. Regardless of the language, the important (and most difficult) part is getting used to iOS framework, the patterns and models it uses, not to mention all the UI widgets and how they interact with each other. I don't think Swift will make it easier to deal with all that, regardless of how well has been thought out.
- rsynnott 12y agoIt's also incorrect; he says he started it about four years ago, though it was just him for a while. > It's a "why-bother?" language rather than a "ack, no!" language. The thing is, what is the alternative? They needed easy ObjC interoperability (all the APIs and third party libraries are in ObjC, and will be for a long time), and thus a compatible object model. That would knock out most alternatives on its own. Even if they were willing to compromise on that, and go with more heavy-weight interop, they'd basically be looking at adopting Rust, which isn't finished, or maybe D. EDIT: On the age thing, by the way, it's also reasonably clear that Swift isn't finished. It should be usable by the time Xcode 6 goes out of beta, but ObjC isn't going anywhere anytime soon, and I expect Swift will continue to evolve for a while yet.
- deleted 12y ago[deleted]
- Tloewald 12y agoIt seems to me that swift is about as good as the other trending languages around (rust, go) as well as the nicer older languages (c# and um...) which is plenty nice. It's not going to convert erlang, haskell, or ocaml users. Now if apple does open source it down the road it could be truly wonderful. C#'s success cross platform, thanks to mono, has been largely despite microsoft.
- araes 12y agoFrom looking through the article, and what's available online (Apple page and Wikipedia), it looks like they took most of what folks like about interpreted languages and just moved them into a compiled form, married to a decent debug / testing environment. It also has a bit of Perl, in that its written so that patterns conform better to English speaking patterns. For example, they use the "let" keyword to do constants like: let appleSummary = "I have \(numberOfApples) apples." and they use Javascript-like simple concatenation operators like: str = "hello," str += " world" And like Perl, I also like that associative arrays / dictionaries are top level: let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25] After that, it mostly looks like standard evolution. They've taken many of the top, or high use programming patterns of the current day for i-products and rolled them into libraries or main functions to speed up development. It could be good. I do like Javascript and Perl, which look like they had a child with Objective-C. And that article has a point that its only main competitor is Obj-C, which is not much of a fight. Now if they'll only allow you to develop and build on non-Apple hardware.
- SideburnsOfDoom 12y ago> And like Perl, I also like that associative arrays / dictionaries are top level: let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25] Is this a perl-ism? It's not much more inference than C#: var people = new Dictionary<string, int> {{"Anna", 37}, {"Beto", 8}}; or a JavaScript array of objects. Also "+= " on strings extends beyond just JS (it works in C# too) and likely several others. Whichever more modern language you're familiar with, you'll probably see an echo of it there.
- wtetzner 12y agoI think let for bindings actually comes from ML. It looks a lot like what you get when you try to take what you can from functional languages while still being an imperative language.
- kbenson 12y agoI don't consider the "let" example to really be very Perlish. The real power of Perl in it's natural expressiveness is to more closely map speaking, and thus thinking patterns to how the algorithm is represented. For example, postconditionals, which allow a single statement to be conditional based on a condition that immediately follows it. This is a natural way people express themselves ("do X if Y" or "do A unless B"), but it is wisely restricted to a single statement as the alternative is less common, less clear. The fact that swift's let statement sounds like common English when spoken aloud is only superficially similar to Perl, IMHO. Additionally some sort of hash/associative array/map data structure at the top level is (thankfully) common at this point. I haven't followed swift too closely though, so maybe there's other stuff that I would consider more aligned with the spirit of Perl.
- wtetzner 12y agoAt least they had the sense to include algebraic data types.