News for hackers. Stuff that matters.
Re:IBM Stops Server Side Swift Framework Development by thrower123 on Monday December 16, 2019 @07:32PM (#21809241)
Outside of iOS, is there really any traction for Swift development? It certainly feels like it is settling into an also-ran position. And really, mobile apps are turning out to be a dead-end, and people don't seem to be actually investing in native clients anymore, they just slap their website in a browser control.
Re:IBM Stops Server Side Swift Framework Development by woadwarrior01 on Monday December 16, 2019 @07:40PM (#21809302)
The creator of Swift (and LLVM), Chris Lattner now works for Google. There’s already an experimental version of Tensorflow[1] for Swift. I personally believe that Swift will really shine in differentiable programming and thus machine learning. A little over a decade ago, most of the machine learning community was using either Matlab (and it’s open source clone Octave) or R.

It took a long time for the machine learning eco-system around Python to develop. I believe that’s the case with Swift as well.

[1]: https://www.tensorflow.org/swift/

Re:IBM Stops Server Side Swift Framework Development by xvilka on Monday December 16, 2019 @09:23PM (#21809893)
Julia is better suited for differentiable programming and machine learning. Something like frontend/scripting with Julia, and computing cores with Rust, as an alternative to the ubiquitous Python + C/C++ stack. And there are already more or less established frameworks for Julia:

- FluxML[1] for machine learning

- Zygote[2] for differentiable programming

- Turing[3] for probabilistic programming

- Rich support for GPU[4]

[1] https://fluxml.ai/

[2] https://fluxml.ai/Zygote.jl/latest/

[3] https://turing.ml

[4] https://juliagpu.org/

Re:IBM Stops Server Side Swift Framework Development by favorited on Monday December 16, 2019 @10:19PM (#21810207)
They examined both Julia and Rust, among others, before deciding to move forward with Swift for Tensorflow.

https://github.com/tensorflow/swift/blob/master/docs/WhySwif...

Re:IBM Stops Server Side Swift Framework Development by cbkeller on Monday December 16, 2019 @10:44PM (#21810321)
Chris Lattner is leading the project, of course they're using the language he designed. Personally I think they substantially underestimated the difficulty of setting up a full technical computing ecosystem in Swift relative to Julia. But, fair enough, if I'd designed Swift I'd probably be dogfooding it too.

Some previous discussions that mention the swift-vs-Julia decision: [1] https://news.ycombinator.com/item?id=19714622 [2] https://news.ycombinator.com/item?id=19884273

Re:IBM Stops Server Side Swift Framework Development by taharvey on Wednesday December 18, 2019 @01:58AM (#21822533)
Actually this started before Lattner. Richard Wei kicked this off with his DLVM thesis.

Either way, Swift's functional design around a type system has some compiler implications towards solving larger problems that Julia probably will struggle with as it moves forward beyond the goal of just being a faster Python.

Re:IBM Stops Server Side Swift Framework Development by byt143 on Wednesday December 18, 2019 @09:33AM (#21825188)
Specifically what?
Re:IBM Stops Server Side Swift Framework Development by taharvey on Wednesday December 18, 2019 @11:49PM (#21832060)
Essentially Swift is in Lattner's words "Syntactic sugar for LLVM"... meaning it was designed from a compilers point of view to provide an ontology for code that a compiler can analyze, interpret, optimize, and enable deeper functionality. Swift backed that ontology with a functional type system that forms a set proofs of the relationships and meaning of your code.

If you take a language like C++, the "atoms" of the code like a Float32, are just hard coded intrinsics in the compiler. As such, they have no ontological meaning in relationship to a Float16, an Int32, or an Array of Strings. In Swift, a float is built from a set of proofs as equatable, hashable, Numeric, FloatingPointNumber, and etc. As related to Julia or Python, a static language built around these proofs, enable compiler's to provide "co-pilot" development assistance, guarantees at runtime, code validation.

Why is this important? With deeper knowledge, a compiler can optimize things in ways that weren't previously possible, extract graphs, and automate code execution in heterogeneous computing evironments.

Re:IBM Stops Server Side Swift Framework Development by xvilka on Monday December 16, 2019 @10:42PM (#21810313)
> We are not experts in Julia, but since its compilation approach is based on type specialization, it may have enough of a representation and infrastructure to host the Graph Program Extraction techniques we rely on.

A quote from your own link. So they admit Julia might be a good fit. The only argument they gave is the "small community size", which is wrong, because Julia data science and any other computational science community is way bigger to almost non-existent Swift one.

Re:IBM Stops Server Side Swift Framework Development by favorited on Monday December 16, 2019 @10:49PM (#21810339)
Yes, and the next paragraph says:

> picked Swift over Julia because Swift has a much larger community, is syntactically closer to Python, and because we were more familiar with its internal implementation details

So Julia could match well, but the team at Google determined that Swift was a better fit for their new TensorFlow platform.

Re:IBM Stops Server Side Swift Framework Development by cbkeller on Monday December 16, 2019 @11:01PM (#21810409)
Well, Julia's technical computing community - arguably the subset that matters here - was much larger than Swift's. The more significant justification IMO, is

> and because we were more familiar with its internal implementation details - which allowed us to implement a prototype much faster.

In any case, both Julia and Swift seem to be making good progress here and I wish them both the best.

Re:IBM Stops Server Side Swift Framework Development by ptx on Tuesday December 17, 2019 @06:05AM (#21812466)
> is syntactically closer to Python

How is Swift's syntax in any way similar to Python? Other than not having semicolons, they clearly belong to different language families and don't seem particularly similar. Is there some very specific feature they were referring to here?

Re:IBM Stops Server Side Swift Framework Development by taharvey on Wednesday December 18, 2019 @01:53AM (#21822500)
The guys in our group giggle at Hacker News. The only time they ever even hear about Julia, is when a Swift article shows up here... then all the Julia nerds come out of the woodwork.

Guessing the opposite rarely happens.

Re:IBM Stops Server Side Swift Framework Development by wwright on Monday December 16, 2019 @07:38PM (#21809282)
As an Apple fan and a programming language nerd, I have basically no interest in ever using the language. I spend a lot of time in C++, Haskell, Rust, and Kubernetes, but Swift just feels pointlessly complicated to me. (C++ I think is also pointlessly complicated, but the rest at least have a point ;-)
Re:IBM Stops Server Side Swift Framework Development by happytoexplain on Monday December 16, 2019 @08:18PM (#21809529)
Wow, that's honestly not an opinion I've heard! I've always felt that Swift is one of the clearest, most comprehensible languages I've ever worked with. It also strikes me as a great balance between simplicity and flexibility/power/features. I don't want to ask you to dive into specifics, since I'm not doing so myself, but I'd love to hear if there's any standout examples of unnecessary complexity for you.
Re:IBM Stops Server Side Swift Framework Development by gurkendoktor on Wednesday December 18, 2019 @03:00PM (#21828741)
Another Apple ex-fanboy here. I loved the conceptual simplicity of Objective-C and its easy integration with the rest of the C-family world, I really enjoyed Foundation & UIKit around iOS 5, I still use Xcode a lot - but Swift made me slowly move back to a C++/generalist career.

As a random example, take the content of this article: https://www.rightpoint.com/rplabs/switch-method-dispatch-tab...

This is something that my less grumpy iOS developer colleagues regularly stumble over, and yet they keep telling me that Swift is super simple.

Also, Apple's tooling for Swift has gotten less crashy, but not more reliable in my experience. Almost every time I command-click a Swift function in Xcode to find its definition/source, Xcode shows me a random C function with the same name in some completely unrelated header file.

I predict/hope that Combine will be peak Swift, and that it will only accelerate the move to Electron and other portable technologies (go Flutter!).

Re:IBM Stops Server Side Swift Framework Development by cellularmitosis on Monday December 16, 2019 @08:16PM (#21809513)
Can you elaborate? Personally, I thought Swift’s distinction between value and reference types was fantastic. https://academy.realm.io/posts/andy-matuschak-controlling-co...
Re:IBM Stops Server Side Swift Framework Development by uwuhn on Monday December 16, 2019 @08:08PM (#21809475)
I'd like to ask what about Swift feels complicated. I'm really curious because I've heard the same thing about Rust, and I also see Swift compared to Rust often.
Re:IBM Stops Server Side Swift Framework Development by zepto on Monday December 16, 2019 @07:41PM (#21809307)
Swift is no more complicated than Haskell or Rust.
Re:IBM Stops Server Side Swift Framework Development by verttii on Monday December 16, 2019 @08:21PM (#21809551)
But Swift has had a more specific target platform, where it wouldn't make sense to produce excessively high level generic abstractions.

Whereas a language like Haskell is happy to try some absurdly abstract concepts in the interest of promoting computer science.

Re:IBM Stops Server Side Swift Framework Development by Tainnor on Tuesday December 17, 2019 @12:17PM (#21815801)
If you don't use complicated compiler extensions (which, to be fair, many people do), then Haskell's complexity is more compositional. There are not a lot of fundamental concepts you need to understand; it's just their combination that creates the complexity (such as typeclasses like Monad).

Swift's complexity feels much less compositional. There are still a lot of situations where I won't really know how certain features interact (especially when it comes to generics, associated types, etc.). Also, the documentation on some edge-cases is basically non-existant.

Re:IBM Stops Server Side Swift Framework Development by wwright on Wednesday December 18, 2019 @12:46PM (#21827313)
I would Swift is more complex than Haskell, though much more familiar to many programmers. Pure Haskell is pretty simple, all in all. Maybe using it isn’t, given the ecosystem ;-)

Swift and Rust are definitely similar in complexity, but Rust actually merits most of its complexity imo. It gives strong guarantees and a strong foundation for the future; I don’t believe that Swift has that. Swift adds a lot of features for the sake of having them, and I think that will catch up with the language quickly (see C++.)

Re:IBM Stops Server Side Swift Framework Development by Apocryphon on Monday December 16, 2019 @08:27PM (#21809581)
Re:IBM Stops Server Side Swift Framework Development by unpluggedcord on Monday December 16, 2019 @09:20PM (#21809869)
FWIW those comment sections are talking about swift 2 and swift 3. Which are considerably older and lacking many features that clean up those concerns.
Re:IBM Stops Server Side Swift Framework Development by taharvey on Wednesday December 18, 2019 @02:01AM (#21822551)
What part of Swift being as fast as C++, as safe as Rust, and with the functional type system of Haskell (but actually useful in the real word) is unappealing?
Re:IBM Stops Server Side Swift Framework Development by wwright on Wednesday December 18, 2019 @12:43PM (#21827274)
I don’t have the time to dive into specifics like the other comments are asking for, but I can say that all three of these claims are false. Swift has significant performance penalties for a lot of its functionality; Rust is significantly safer and lower overhead (Swift doesn’t do anything about thread safety or mutable aliases, for starters); and Swift’s type system, as far as I know, is not as advanced as Haskell’s (and also significantly less ergonomic when it does match functionality, imo.)

I will say that I think the language made compromises in all three of these directions, though.

Re:IBM Stops Server Side Swift Framework Development by taharvey on Wednesday December 18, 2019 @11:23PM (#21831989)
I would encourage you to look deeper.

1. We've moved our company code base from tight C/C++ code to Swift. It is just as fast, with higher level syntax. In some cases faster. It has native SIMD types without external libraries too. Moreover, the Swift group has been focusing on correctness over performance to date. The goal has always been, that its deeply typed design can enable optimizations not even possible in c/c++.

2. Several of the founding Rust team moved to the Swift dev team years ago. As of Swift 5, the memory model supports the Rust-like borrowing. One could say Swift at this point is a complete superset of Rust. But, more importantly Swift favors a functional style of value type operations... which are inherently memory safe, and have no concurrency side effects in the first place. Value types together with Swift's very easy to use Dispatch concurrency library work for most use cases... it is viewed that "borrowing" is only a special purpose opt-in feature.

3. Swift is pragmatic. It is functional in its type system, value type operation, and no side-effect philosophy. But it is multi-paradigm, flexible, and designed for the real-world problems that reflect real programming needs... where as Haskell is arguably an academic curiosity and extremely unlikely to become a mainstream general purpose language.

Re:IBM Stops Server Side Swift Framework Development by favorited on Monday December 16, 2019 @10:20PM (#21810212)
> mobile apps are turning out to be a dead-end

Been hearing that for a decade now, but somehow I'm not out of work.