News for hackers. Stuff that matters.
Re:Swift 5.0 release process by patientplatypus on Tuesday September 25, 2018 @05:20PM (#18070586)
OK...stupid question.

Why not use Flutter? Even React Native is cross platform. Why are we still using a programming language for a phone app that means we have to write the darn thing twice? Even a RN webview pointing at an IP with code written in whatever-lang is seemingly a better choice.

Re:Swift 5.0 release process by bsaul on Tuesday September 25, 2018 @05:27PM (#18070628)
Have you ever developped anything serious with swift ? Honestly, this is by far the best language i've developped in (including go, java, c#).

Note that i'm talking about the language here. The libs are of various quality. But powerful enums & switch + null safety + generics while retaining the ability to be learned easily by any "regular" developer makes it a category of its own.

My secret hope is that someone somewhere is working on a flutter equivalent coded in swift.

Re:Swift 5.0 release process by yxhuvud on Tuesday September 25, 2018 @06:11PM (#18070978)
Have you looked at Crystal? It has a lot of the same strengths you note that swift has, but with stronger Linux support and a more rubylike expressibilty and stdlib.
Re:Swift 5.0 release process by pjmlp on Tuesday September 25, 2018 @05:41PM (#18070747)
Swift is quite good for developers on Apple platforms, but isn't unique in language features nor tooling.

F#, Ocaml and Haskell come to mind.

Re:Swift 5.0 release process by dep_b on Tuesday September 25, 2018 @06:00PM (#18070884)
Swift has a nice mix of features that allows you to write pretty close to functional while also allowing you to write code that compiles to the same code as equivalent C (albeit a bit more verbose).

I don't think there are any languages out there outside of Rust (which has it's own niche since Swift is ARC and Rust is more or less manual) that does the same.

F# should get a bit more love by Microsoft.

Re:Swift 5.0 release process by pjmlp on Wednesday September 26, 2018 @01:52AM (#18073090)
ARC is just a GC implementation algorithm with a couple of compiler optimizations to reduce counting operations.

Plenty of GC books describe such algorithms, including the canonical "The Garbage Collection Handbook".

All the languages I referred do compile to native code as well. So you can also check the generated Assembly, just like with C.

They also do provide ways of doing C pointer style tricks, use value type allocations or manual memory management.

Then there is ATS and ML Kit as well.

As language greek I do like Swift, but it isn't really meaningful outside Apple's ecosystem.

Re:Swift 5.0 release process by bsaul on Tuesday September 25, 2018 @05:58PM (#18070866)
I honestly never understood why F# has never managed to get more popular. Ocaml style type system with .Net lib support would have make it an absolute killer language if it were really advocated by MS, but they probably thought the language was too different from C style to be really mainstream...

Or are there any other reason, more technical ?

Re:Swift 5.0 release process by DennisP on Tuesday September 25, 2018 @06:05PM (#18070926)
I haven't done .Net for a couple years but Microsoft never really supported F#. It wasn't a full-fledged citizen in their web frameworks; you could include compiled modules that you made with F# but couldn't use it the way you use VB or C#. And you'd think a functional language would be great for data transformations in SSIS, but same deal there, just VB or C#.

Microsoft always positioned it as "use F# for the hard stuff and C# for the rest." The trouble is that C# isn't that bad for the hard stuff, and if you're spending most of your time with C#, then for you it's probably better than F#.

Re:Swift 5.0 release process by pjmlp on Wednesday September 26, 2018 @02:12AM (#18073177)
Microsoft's management cannot make their mind what it is good for, mainly because FP is not really something that 99% of typical enterprise developers care about.

When they made it officially part of .NET, it was the black swan of .NET languages with tooling only for libraries and command line applications.

Afterwards they attempted to position it as a language for ASP.NET MVC applications.

Then they largely left it for the community as F# was one of their very first FOSS projects.

Meanwhile the new MDIL compiler came out for Windows 8.x, followed by .NET Native, none of them support MSIL features required by F#.

Likewise .NET Core only accounted for C# and VB.NET, and they are still reimplementing type providers and the REPL for it.

Finally after all these years F# still lacks tooling for Forms, WPF and EF.

Meanwhile C# keeps getting some F# features.

Currently F# is being positioned as a language for data science with its type providers and Azure Netbooks.

Re:Swift 5.0 release process by phreack on Tuesday September 25, 2018 @05:35PM (#18070695)
Then you ought to try Kotlin! It's a lot like Swift but with great libs and tooling.
Re:Swift 5.0 release process by bsaul on Tuesday September 25, 2018 @05:41PM (#18070741)
Except kotlin doesn't have anything close to swift regarding enums + switch (like : enum with associated values of various arity, and a switch that makes sure you're handling all the cases), nor regarding null safety.

And, it still has java underneath, which means everytime you're using a java lib, you have absolutely no idea what the null safety is going to be underneath (which is also the case with swift and objc libs, but which diminishes the attractivness of using the java libs ecosystem)

EDIT: also, value-based programming is highly encouraged by the full support for structs, either mutable or immutable. That's also a huge plus for safety against race conditions.

Re:Swift 5.0 release process by dualscyther on Tuesday September 25, 2018 @06:02PM (#18070907)
Kotlin has sealed classes (enums), when expressions (switch checking) and absolutely does have null safety. It also reinforces null safety when using Java libraries if they have nullability annotations.
Re:Swift 5.0 release process by saagarjha on Tuesday September 25, 2018 @05:48PM (#18070800)
Kotlin might look like Swift on the surface, but under that they're very different in how they're designed.
Re:Swift 5.0 release process by millstone on Tuesday September 25, 2018 @08:55PM (#18071815)
Surely the question of using Kotlin is dominated by whether or not you can tolerate the JVM.
Re:Swift 5.0 release process by singularity2001 on Wednesday September 26, 2018 @03:42AM (#18073635)
you can compile to native with kotlin-native but compilation times are even more abysmal than the jvm kotlin.
Re:Swift 5.0 release process by izacus on Wednesday September 26, 2018 @04:12AM (#18073826)
What difference does that make?
Re:Swift 5.0 release process by scarface74 on Tuesday September 25, 2018 @06:40PM (#18071160)
Because every cross platform solution is better for the developer but worse for the user.

Also when the platform vendor makes changes, you have to wait for the cross platform solution to catch up.

Re:Swift 5.0 release process by paulddraper on Tuesday September 25, 2018 @05:38PM (#18070725)
Swift compiles natively and runs on iOS, Android, Linux, MacOS, and there is a community project for Windows.

Most of the iOS platform libraries are only available in Objective C and Swift.

Most of the Android platform libraries are only available in Java (or other JVM languages).

Re:Swift 5.0 release process by Eric_WVGG on Tuesday September 25, 2018 @05:23PM (#18070609)
who said anything about phone apps?
Re:Swift 5.0 release process by coder543 on Tuesday September 25, 2018 @05:37PM (#18070712)
Swift is not seriously useful for server-side applications at this point. None of the web frameworks have even remotely great performance, and Swift is compatible with almost nothing on Linux, since Apple has put minimal effort into anything but macOS and iOS... so anything you do would be much more painful than using Go, Rust, or even C# (.net core) on Linux.

So, maybe you're just talking about desktop macOS in addition to phone apps?

Re:Swift 5.0 release process by favorited on Tuesday September 25, 2018 @05:42PM (#18070753)
> None of the web frameworks have even remotely great performance

Source for that claim?

Vapor has some pretty great benchmarks. https://medium.com/@codevapor/vapor-3-0-0-released-8356fa619...

Re:Swift 5.0 release process by coder543 on Tuesday September 25, 2018 @06:07PM (#18070945)
It literally only compares itself to slow, interpreted languages and other, even slower Swift frameworks, with the singular exception of Go, where they're using Gin, which is a rather slow Go framework. Gin is at literally 10% of the performance of the fastest Go framework, as shown here: https://www.techempower.com/benchmarks/#section=data-r16&hw=...

So, when you cherry pick benchmarks, it can _look_ kind of fast... but then the unbiased TechEmpower benchmarks show Vapor operating at 20% of the speed of Gin. Which is 2% of the speed of the fastest Go or Rust web framework.

"50x faster to pick a different language" != "even remotely great performance."

Re:Swift 5.0 release process by merlinsbrain on Tuesday September 25, 2018 @07:06PM (#18071313)
I’m not sure this is a great benchmark (detailed in a comment above), but I think it’s undair to criticize a web framework for comparing itself to Django, node/express, Elixir/Phoenix. While dynamic languages, there’s billions of $ running on those frameworks and to present yourself as a fair alternative to those is good enough.

(I have no personal interest in Swift on the server, I use Go/echo)

Re:Swift 5.0 release process by bsaul on Tuesday September 25, 2018 @05:49PM (#18070804)
i think the techempowered benchmarks [https://www.techempower.com/benchmarks/] don't show a pretty picture for swift-based web framework. But hopefully swift nio will change all that..
Re:Swift 5.0 release process by merlinsbrain on Tuesday September 25, 2018 @07:03PM (#18071299)
> We were pleasently surprised to see Vapor coming in first as being asynchronous does not really help with plaintext benchmarks. Plaintext benchmarks are really only good at testing how fast a web framework is capable of parsing and serializing HTTP headers.

I did not look if other benchmarks were released but this is probably not the best representative.

Re:Swift 5.0 release process by helge5 on Tuesday September 25, 2018 @09:13PM (#18071887)
Swift on server may not have "great performance", but compared to mainstream stuff it definitely has "pretty good performance" while still providing a somewhat nice language.

I guess the key selling point is, well, being able to use Swift on the server (some people do like the language). It is pretty useful for sure. Certainly not the only choice.

That Swift is compatible with almost nothing on Linux sounds strange, not sure what you mean by that. E.g. I find it particularly nice for writing Apache modules (the Swift C integration is really neat).

P.S.: While Apple puts minimal effort in anything but macOS and iOS, others put significant effort into Swift on Linux. Like IBM.