100 points · by asparagui · 7y ago · 52 comments
Kotlin is successful because Google was able to drive the direction of the language. For example AndroidX Compose is being built with compiler extensions in Kotlin with Jetbrains. Dart is obviously driven by Google.
Swift is going to be controlled and driven by Apple. From a strategic perspective, I don't understand why Google would make an investment like this when Swift-for-Tensorflow has a fundamental need to drive changes in the language itself.
Now, I understand if Google didn't have an alternative. Are you saying Kotlin is soooooo worse than Swift that you can't fundamentally take a similar direction ? Kotlin is currently one of the world's most popular languages, born out of sheer LOVE from the community (without being pushed by the giants).
https://github.com/tensorflow/swift/blob/master/docs/WhySwif...
Presumably Kotlin wouldn't work for the same reasons they excluded Scala and Java and C#.
(I think that either of C++ or Julia would have probably made better choices, given what they spell out here, but they put a lot more thought into what language to use than most HN commenters seem to give them credit for.)
Now, it's possible that they were less objective about the language choice than they believe themselves to be, but they certainly have thought about it an awful lot, and they deserve some benefit of the doubt, unless you can demonstrate what of this justification is untrue.
Also, Kotlin/native is fully compiled.
Who knows, maybe in 5 years it will make the list.
I like Swift and all but our ML/DL/RL/DS tools and libraries are in Python (and occasionally R). Most are missing for Swift without an awkward Python compatibility layer and I don't see a compelling reason to adopt it.
I do think what is being done with Julia, Cassette, Flux and Zygote more interesting since it's Julia all the way down (while Tensorflow's backend is still C++) and the compiler work is focusing on not being specific to one implementation or technique, but allowing any such language extensions (such as auto-parallelization and other forms of source to source transformations) to be done by any 100% Julia library. So if Tensorflow for Swift (regardless of the actual reasons behind the choice of the language) proves that the technique is a significant upgrade over what currently exists, it could spark interest in the competing approaches, and I think Julia can help pushing the concept even further.
the python interoperability allows you to use all python libraries but in swift
And there is the risk that the community simply ends up considering that good enough and just make wrappers (since it needs a lot of work to create something nearly as good from scratch). Thankfully that didn't happen with the Julia community, and the key is probably making the creation of the tools much easier so they can catch up to mature but constantly evolving environments.
As its very common to target this sort of code to GPU´s, and LLVM can target them as output, i think is mostly because you can design and shape the langage right on its high level representation and tune for high performant code in the low level.
The why, i think, its about opportunity.. Chris Lattner going to Google, and people from the language and the compiler side of the fence being open about bake this right into the compiler when necessary.
You seem to imply that people who upvote both Swift/TF articles won’t upvote Julia ones.
For me personally, I have upvoted earlier Swift/TF articles because they were well-written, and integrating differentiation fairly deeply into the compiler seemed novel to me.
I think I also have upvoted some Julia articles in the past, not because they were about Julia, but because they were interesting and well-written.
”tools and libraries are in Python (and occasionally R). Most are missing for Swift without an awkward Python compatibility layer”
An upvote need not mean “that’s immediately useful for me”. It could also mean “I like Swift, and this looks quite an improvement for it, making it more competitive with the leading technologies for machine learning” (you like Swift, so you _could_ upvote articles like these for that reason, too)
Edit: I apologise, just after posting this comment I saw this link had already been posted. https://www.fast.ai/2019/03/06/fastai-swift/
As a stopgap while all the data science tooling is being built out for Swift you can use anything from the Python ecosystem (including np and pd) by using the Python interop:
let np = Python.import(“numpy”)
https://github.com/tensorflow/swift/blob/master/docs/PythonI...
> To accomplish this, the Swift script/program simply links the Python interpreter into its code.
I would imagine that having the interpreter in another process would be a gigantice performance hit.
And people are still doing a lot of Data Science work in R and Scala so I wouldn't say it is at all Python centric.
Disclaimer: I don't use Windows but read the Swift development forums from time to time.
Linux support for this can't be sub par since the whole stuff will run on linux like 99.99% of the time.
But i guess the pure Windows ecosystem is rough on the edges right now, but doable. And in WSL(1) things have worked pretty the same as in Linux.
Just download the packaged binary distributed on their site, and you are ready to go.
(Oh, a note; its not the tensorflow branch, if is thats what you want)
Absolutely not. Julia would have been a far better fit.
The idea of LLVM/Swift ‘turtles all the way down’ might really pay off in the long run. In TensorFlow there is an un-understandable barrier (for me) between the Python layer and the lower level C++ code. Good to see this Swift effort along side Julia + Flux, which offers the same implementation language for the whole system advantage.
It’s not ready for prime time yet but the roadmap looks great. Building auto-differentiation into the language and having an easy way for anyone to experiment with core architecture changes (without killing performance) will be a huge win for everyone.
I expect lots of prototyping will be done on S4TF (because it will be easy for developers to keep things on the GPU with XLA and MLIR) and then the things that work will be back-ported to other ecosystems.
https://medium.com/tensorflow/mlir-a-new-intermediate-repres...
Specially when Windows had the best GPU support.
Good luck with those CUDA drivers, and visual GPU debugging.