“Swift will be open source later this year”
apple.com
apple.com
Supporting the standard libraries on Linux is certainly a surprise, though.
Think: How many iOS apps are frontends to a server API? And how many of those APIs are running on Linux servers? Swift on Linux means ~all the code for a client-server iOS app can be written in the same language.
Android ships with Bionic libc, which is different from the glibc that is usually shipped in a Linux distro. There are definitely some differences between the two.
Plus the average Android app is very far from the average Linux app. If they were aiming at supporting Android, I think they would have said that instead of Linux.
With that said I will root for Clojure + ClojureScript. One could theoretically build a framework much more advanced than Meteor, on the same code-sharing principles.
https://news.ycombinator.com/item?id=9500855
Being able to deploy on Linux might be what it takes!
Swift on the backend would be even better, I think. Between all the languages that have evolved lately (including Go and Rust), Swift has struck me as the one that feels the most like my ideal language.
If anyone has an old mac that can run modern xCode (you probably know what this constitutes more than me) and wants to donate it to a dedicated open-source developer for completely unspecified future projects, feel free to email me at (my handle on hn)@(googles email service). thanks
I've been using a hackintosh since 2008. It's literally never been easier to get one up and running.
...I'll show myself out.
Almost all the documentation and best case expects Macs to be tied to an Active Directory / MS environment for management.
As a typical Web / LAMP host, OS X really is not that performant. Unix tools execute faster on a RHEL/CentOS box then an OS X (even if the OS X box has higher specs). MySQL is particularly bad if it hasn't been tuned, and most of the literature seems to indicate that OS X (or more specifically MACH) doesn't have the level of optimisation for server workloads.
That being said, if your using the OS X frameworks, there can be some great value with exceptional performance (just look at the startup using Mac Pros as image manipulation servers).
Now with the move of things into just the app bare bones style docker VM's in which the app is a service upon a server then maybe some form of runtime that enables some applications would be useful, maybe.
But if they went into the server market, then the trust of doing partnerships with server focused vendors would diminish. Though VMWare would probably be just as happy, if not more and that would be about it. IBM, for the arrangements they have now, work for both of them too well to upset I feel.
Mark my words: Swift won't replace JS, not even PHP.
EDIT: Also, what's the point of writing Swift code in Linux if you aren't developing for iOS? As a non-iOS developer nothing at all compels me to learn Swift. It doesn't bring anything to the table that JS, Python, Ruby etc don't already do better. Except iOS support. HN tends to forget that just because iOS is the default in the US it's not internationally. Apple is a luxury brand, not a commodity one.
Golang is a pragmatic crowd. Go into #go-nuts on freenode, you'll notice that discussion rarely deviates from solving problems. Many links to the go playground. Go, from the beginning, shaped their community in this way. Consciously? Who knows. But the community turned out the way it did and I believe that's a result of their start.
Haskell is a computer scientist crowd. People write in haskell because they enjoy the functional paradigm and haskell is a purely functional language. Discussion on freenode? Very dense. People are expected to grasp topics easily and the community initially gives everyone the benefit of the doubt that they are capable of understanding it until they ask for more help.
When I look at swift, the only thought I have is that it is the new iOS language. I don't believe they'll be able to deviate from that. I don't see myself making iOS apps, so I don't see myself every writing a single line of the language. When I first looked at swift, my impression was that it was a wierd and somewhat-functional language that had a few unique things. Maybe I would have taken an interest in it. But at this point, I don't want to have to wade through a bunch of iOS specific questions to get what I need. I don't want to have to deal with being a beta tester for their linux implementations. I don't want to use the language when I'm probably going to be using it in a vastly different way than the rest of the community is. My interests are going to be second class.
It's not necessarily set in stone, but I think it is. In a world where there's a new language every day, I just don't see why I'd go with swift.
Go has been out for 6 years and has less than 10,000 questions on StackOverFlow: http://stackoverflow.com/questions/tagged/go
Swift has 37,000 questions in its first year: http://stackoverflow.com/questions/tagged/swift
I'm a fan of Go. I built my websites in it and I've written a few small apps.
However, you really are overlooking how much of a difference the bigger Swift community will be.
All bets are off if Google officially supports Go on Android.
Anyway, 1,000,000 Swift developers will change everything.
If I started writing an HTTP server in Swift the day it comes out I won't find much help but I'll have a mountain of unrelated answers to filter. Essentially Swift's adoption for iOS apps doesn't help and might hurt efforts to use it elsewhere.
Look at Object-C: extremely common writing software for Apple; almost non-existent elsewhere, despite the fact that it has never been limited to Apple.
Again, why would any Android developer choose Swift? Kotlin also runs fine on the server and it even compiles to Javascript.
If I were a startup doing an iOS, Android, and a backend I would do either Go or Rust on the backend. You will be able to distribute a native lib with your Android or iOS that shares network and model logic. Go and Rust both are planning on supporting cross compilation to iOS and Android.
That would leave you with Kotlin/Groovy/Clojure/Scala for the view layer of your Android app if you choose not use Java. Which is a good idea since there is no indication from Google Java 8 will be supported which means no lambdas unless you use an alt JVM language. On iOS you write your view layer in Swift. Both apps use the shared binary library.
- https://github.com/search?l=go&q=stars%3A%3E-1&ref=searchres...
- https://github.com/search?l=swift&q=stars%3A%3E-1&ref=search...
- https://github.com/search?l=rust&q=stars%3A%3E-1&ref=searchr...
All of these objective-C developers changed nothing for non-ios crowd. Why would swift be different?
That's just like your opinion man.
If Swift is Open Source it's gonna be a huge thing, for two reasons: (a) it already attracts millions of developers because it's the suggested language to develop iOS apps in, and (b) it's a nice modern language that plays in a very hot niche (with languages like Go, Scala, Rust etc).
>When I look at swift, the only thought I have is that it is the new iOS language.
OTOH, tons of people and HN and elsewhere expressed their liking for the language and how they wished it was open sourced so they can use it elsewhere too.
Why do people keep on saying that? Would people say javascript is for the pragmatic crowd because jsfiddle exists ? no
Go is a badly designed language period. the type system forces devs to write runtime type assertions which should be the job of the compiler thanks to parametric types, if go designers knew one or 2 things about types. The fact that Go dismisses 30+ years of type theory isn't pragmatism. It's ignorance.
Nobody would call PHP pragmatic yet even PHP is more expressive.
This is a toxic attitude. It suggests that if people don't get something right on the first try they shouldn't try to improve it.
"Better late than never" is true in many cases, and this is one of them.
Their attitude towards exception handling and generics has never strike me as being overly pragmatic.
Avoiding this "fracture" could have been a powerful argument for it, along with maintaining control (the nodes iojs situation could not have inspired confidence, though that was not due to interoperability from what I know)
I would have definitely participated in the hate if I had seen that thread, all I can saw now is: bravo Apple! More of this please!
Sometimes companies change their minds this way, like how Microsoft changed its mind on the banning of DVDs for Xbox, even though they never "officially" said they would do that before the announcement of the Xbox One, but it was strongly "rumored" they would do that. I'm sure that's what they intended, but the outrage was too big to let it be.
Sadly, this never came to fruition, supposedly due to legal complications. Since they own Swift, and the underlying compiler infrastructure this may be simpler to pull off.
Still waiting.
It's hard to realize most of the performance benefits when everything you're interacting with requires objc_msgsend or uses NSArray / NSDictionary.
As well, it's far less 'scripty' than Obj-c. The type system in swift really leaves something to be desired in terms of typing types. The point of Obj-C was kind of to avoid writing the kinds of apps where a great type system would really shine, swift lets you build those kind of apps, but in my opinion most of the time we shouldn't be building them.
Your project probably doesn't need 1,000 developers on it who need solid interfaces and type checking to make sure that everything is going according to the UML diagram. It probably needs 2 or 3 developers who talk to each other, add asserts to their code, and a type system thats a little forgiving.
ObjC is a language that has everything you really really need, and left out the 1 thing you kinda wanted in exchange for leaving out the thousand 1 little things that everyone else wanted too. Like for example exceptions, sure they're there, but it's not idiomatic and when you program without them you realize what a crappy idea they were in practice. In day to day coding NSError is 1000x better than exceptions.
Can you clarify this? What is the kind of apps where a "type system would really shine"? How can you avoid writing them?
The switch when dealing with a combination of C/C++ and Objective-C source was not really a problem. But trying to interface a C++ library into a Swift application is less than a fun experience.
Personally, while the language is fresh and seems pretty good (it has some great additions), I still prefer Objective-C. I guess I'm waiting for better integration with existing libraries.
But that's not surprising given its ecosystem; as others have mentioned, language success has less to do about its theoretical benefits and more to do about what environments it allows the developer access to. Javascript is the case-in-point; I think few people would argue it is a well-designed language, but if you want to do web development, you're going to need at least a basic understanding of it, so it maintains brutal popularity.
The overall combination of Swift and Objective-C in those numbers make me believe Apple's decision to make Swift open source is less about goodwill, and more about stopping the bleeding.
expected things are, by their very nature, hypothetical until they come true or are proven false.
React Native is a godsend.
Something which has nothing to do with the language.
Here's how you do it with a popular Swift lib:
let json = JSON(data: response)
if let userName = json[0]["user"]["name"].string{ .... }
let parsed: AnyObject? = NSJSONSerialization.JSONObjectWithData(data,
options: NSJSONReadingOptions.AllowFragments,
error:&parseError)I also don't get how a JSON parse takes half a day. If you know the language it shouldn't take that much time. If you don't know the language then a complaint wouldn't be intellectually honest would it?
I haven't either, but I haven't used it a lot so I can't give a final verdict on it. But I'm the kind of person that enjoys C++ (well, especially after C++11, feels like a new language and I'm slowly becoming a C++ fanboy), and I guess all those new system languages like Swift and Rust are supposed to fill the void for people that don't like the existing system languages available, so maybe it's not for me.
It's amazing what some opening of control will do.
You can be sure Apple will remain the exclusive ruler of what goes into Swift.
https://android-review.googlesource.com/#/c/150214/
Looks like there is someone at Google working on lambda support.
Kotlin gives you lambdas, named parameters, extension functions (like C#), data classes, first class null, and more today on all versions of Android.
It's already been done :D
http://www.h4labs.com/dev/ios/swift.html
All this makes it much easier to learn Swift in a short period of time.
Rust on the other hand...
I doubt it will be more attractive to functional programmers than Haskell, though; although the fact that it's an open source language that lets you do functional programming for iOS is pretty huge, IMO.
I can easily imagine Swift joining F# in terms of corporate adoption.
The purpose and syntax of QML and Swift are similar, too.
PS: Qt is not only a GUI framework. It's a cross platform C++ framework.
To me (someone who does Lisp & JS, so none of these all) go seems cool for concurrency and being 'boring' (in a great way). Rust seems cool for being very robust and 'safe' (or hard to screw up with), while still doing concurrency nicely and letting you code in high and low level.
Is there any ways that Swift is more than ObjC without [[[[all] the] square] brackets]? (nothing wrong with that, if you're not into square brackets)
Swift is like Rust in that it's intended to be fast, "safer", and compiles to LLVM bytecode. Also, Swift and Rust both use Option types for error reporting rather than exceptions or error codes.
In the same sense that Rust is a way to leave behind old C++ baggage, Swift is a way to leave behind old ObjC baggage such as header files, null pointer errors, and lack of real namespaces.
[0] http://www.apple.com/live/2015-june-event/eda6e3f7-0fda-4b46...
I'm a bit naive about the environments languages have to run in... but if we have a web app framework in Swift, Servers in swift (as mentioned in comments above), and iOS in swift, doesn't that make Swift a JS replacement too?
Much better than supporting an API that requires 600 LOC for drawing a triangle and isn't available anywhere besides the reference platforms.
The "language" may be "open sourced"; but will the important Cocoa implementations be open sourced?
It shouldn't be to too tough to re-implement Swift; unless Apples starting suing people for doing it.
The exact meaning of Apples announcement needs some clarification.
Cocoa won't be made Free, no, but perhaps Swift could be used with GnuStep's implementation of the libraries.
It's better to not re-invent the wheel.
I think Foundation might be necessary though, even if you just use Swift structs (Array, Dictionary, etc)
I'd love a portable GUI API that satisfies some harsh conditions: 1) Portable between mac,linux,windows,android,ios. [ must re-compile to target ] 2) Compilable into a single static binary. 3) New developments don't break backwards compatibility.
And let's be honest Swift is great and all but it's hardly the crown jewels of the company they are giving away.
They also have a precedent for being less than friendly towards FOSS[0][1][2][3], despite the way they try to present themselves otherwise by listing their open source contributions prominently.
Note that the author of these comments, saurik, is Jay Freeman, the creator of Cydia. Key quotes include:
> Apple has simply never been in compliance with the LGPL [for WebCore].
> As for Oracle, I think Apple is much more harmful [to open source]
> I have gotten so used to Apple giving open source the finger, and thereby have backup plans involving disassembles for most of the things I care about at this point, I had forgotten to even follow up on them failing to release anything
[0] https://news.ycombinator.com/item?id=2083953
[1] https://news.ycombinator.com/item?id=2523784
The first question you should ask for any systems language is how to I integrate assembler, when the answer is to use C / C++ then you know it's not a systems language.
Also, how you can tell a language is a systems language, it has an operating system written in it used by a large user base.
How do you layout a struct in Swift so that it's the exact size and layout you want? You can't, again, not a systems language. It's like going to Home Depot and buying "industrial grade" appliances which are usually just your standard shitty appliances with a stainless finish.
I'd hazard that the engineers at Apple are perfectly qualified to identify what is and isn't a "systems language" working for one of the few companies that has actually developed several from scratch (I am referring to A/UX, Mac OS Classic, Newton OS, and NeXTStep / OpenStep / OSX / iOS in case you're wondering).
Edit: You can also link against .o files with Swift, which is the only sane way to integrate assembly language anyway (i.e. in a separate compilation unit).
> Swift is a successor to both the C and Objective-C languages.
https://dev.windows.com/en-us/uwp-bridges/project-islandwood
https://news.ycombinator.com/item?id=9471204
So ironically this announcement might benefit Microsoft a lot.
They're doing Linux but not Windows? Is Windows not sufficiently important or maybe they just forgot to include Windows in the announcement?
Swift won't bring much anyway.
1. Being able to upstream more into LLVM means less maintenance of their internal forks.
2. The recent open sourcing of Microsoft .NET core parts.
I've been watching for the language to move to instead of Python3. Of Rust, Go, Swift and other new languages, Swift always seemed to me the most appealing language.
Being the 1st class citizen on iOS makes learning this for serverside development very appealing. An ideal server language that enables single language client-server applications possible with iOS.
Once the popular libraries start to drop Python2 support (which may take decades, who knows), this is a no brainer as the language to migrate to instead of moving to the much less robust Python3 ecosystem.
Regardless being able to implement backend and apps in one language is huge.
The ability to rent a cheap VM to run a C# MVC application is great! Previously, I only wrote C# @ work, now I have the ability to do it outside and in. No one wants to pay XX$ more per month to license windows on a VM(at least not for the hobby stuff I do outside of work for fun)
I imagine it will be the same for iOS developers, it may not draw in new developers but there is a good chance that is may be used on projects that would've typically used a different platform simply because swift only runs on iOS.
The language probably won't see an explosive growth in new developers but you will see swift being picked over another language in places it wouldn't previously run.
Some of us have been waiting for a production-ready way to run .NET on Linux and although it is coming it has not arrived yet.
So can we finally say that Hell has Frozen Over?
Microsoft Open Sources Parts of Visual Studio and releases Linux Software.
Apple open sourced their language and it will work on Linux.
This is a win for Apple only.
Also the first challenge will be to build a library that implement all the Swift UI elements to Android (or vice versa) or better Google reinvent their UI or at least add more features and turns Android in a real MVC (bind the view with the controller).
I sort of get it for Python, means you can download the C files and mess with them.
But isn't Swift written in like Assembly?
Swift on Stilts?
a) I see it
b) Facetime becomes an open-standard like promised
Microsoft opened .NET, while apple is just releasing a language for its platform because mozilla and Google did too. While the latter opened sourced the languages.
Microsoft is just getting out of their walled garden, while Apple still has a much stronger one, which is worse because they tie their software with their hardware, which is a really dubious practice in my opinion.
I'm really starting to question the trial decision that made it illegal for developers to just run OSX on PCs. Either way we really need laws to prevent manufacturers to restrict other softwares from running on their hardware.
I slightly hated microsoft but always loved their OS and at the time I did not care abut apple. But now do I hate them.
I bet: * Swift will get ported to Android. * Swift will compete with Mono. * Xamarin will add Swift support to Mono.
Apple adapted how Facetime works to meet their demands, but that meant that Facetime wasn't the same anymore.
Deleted comment
Consider that while Objective-C is open source, Objective-C 2.0 was produced without any effort at all at standardization.
I attended the 2008 WWDC. One of Apple's engineers was demonstrating Objective-C++ and actually said "You can freely mix objective-c and c++." I wanted to start screaming, maybe beat him senseless.
I've done quite a lot of Objective-C, and quite a lot of C++ but I'm still not sure I can figure out how to mix the two.
By using Objective-C++. Just name your source file with the .mm extension and Xcode automatically starts compiling it as Obj-C++. If you take Objective-C, remove all the C from it, and take what's left and slap that on C++, that's Objective-C++. And it really does work, and prior to Swift's announcement I thought it was the best approach to doing Cocoa development (because with ARC you can even put Obj-C objects into C++ data structures and do fun things like `std::vector<std::tuple(id,CGRect,NSInteger)>`).
Is there even one doubt that this will happen?
If not, the pedantic distinction between "announce they intend to" and "doing it" is extremely worthless...
I rebuilt a dysfunctional OS X application that was ported from iOS (obj-c) from the ground up almost entirely in Swift last year, and really enjoyed working in swift. It's worlds better than Objective C, and compares favorably with other modern languages like Go (which I also like and use quite a lot). It takes a minute and a bit of annoyance to get used to optionals, but that ends up being really nice for issues most languages let you shoot yourself in the foot on. Along with switch patterns, easy immutability, memory management, string handling, and Playgrounds/REPL make it a really pleasure.
Even with that endorsement I couldn't recommend it seriously for anyone without being cross platform / open source. Now I can say I really think it's worth learning.
I've never had a good experience with an Apple product.