News for hackers. Stuff that matters.
Re:The Decade of Swift by zozbot234 on Tuesday December 31, 2019 @01:12AM (#21919304)
Rust can be quite usable and productive if you know the right shortcuts. The tradeoff is somewhat lowered performance (and Rust makes sure that you're aware of where you're choosing that tradeoff) but that's just the way it goes. It's not like Swift is any different.
Re:The Decade of Swift by skohan on Tuesday December 31, 2019 @03:43AM (#21919756)
I think Rust is a fine language, but it's undeniable that it involves more tedium than other languages to use.

If there is some tradeoff between safety, performance, and usability, Rust has prioritized safety and performance, where swift has chosen safety and usability. And that's perfectly fine. I am glad that Rust exists for those use-cases where the performance is important, but there are also cases where it's more important to be able to write a lot of code quickly with less friction.

It doesn't devalue Rust to admit that there are places where it is not the optimal choice.

Re:The Decade of Swift by zozbot234 on Tuesday December 31, 2019 @03:51AM (#21919782)
> more tedium than other languages

Perhaps you haven't programmed in Java. Or even C++, for that matter (modern "Core C++" programming can be quite tedious at times).

I'd say the jury is still out when it comes to Rust vs. "higher level languages", yes, even Swift. The point of my comment is that the "friction" you're pointing to need not be an inherent property of something like Rust, any more than it is in C++. It remains to be seen if the 'tradeoff' you mention is a binding one.

Re:The Decade of Swift by skohan on Tuesday December 31, 2019 @04:43AM (#21919952)
> Perhaps you haven't programmed in Java. Or even C++, for that matter

I never said Rust was the most tedious language, and I would hope it has learned something from those decades old languages.

I agree that Rust has some usability issues which can be improved upon without sacrificing safety and performance, but I think that trade off will always be there at some level.

For example, Swift’s copy-on-write makes it very easy to reason about value types, but comes at the cost of performance since there will be a lot of copies which aren’t strictly necessary. You can get essentially the same behavior in Rust by cloning everything, but it takes a lot more typing and adds visual noise to your code, because Rust has made the default to be more parsimonious with memory usage.

At some level trade offs have to be made. No one language can be all thing a to all people.

Re:The Decade of Swift by pjmlp on Tuesday December 31, 2019 @05:42AM (#21920139)
Thing is, yes it might cost performance, but does it matter?

It all boils down to, does it deliver what the customer of an application written in Swift is asking for?

Re:The Decade of Swift by skohan on Tuesday December 31, 2019 @06:09AM (#21920245)
Yeah that is exactly my point. In many cases all the extra work you put into writing Rust code for the additional performance is just that: extra. It doesn’t add any meaningful value to the final product, and it comes at the opportunity cost of that time you could have spent adding or improving features in a more productive language.
Re:The Decade of Swift by pjmlp on Tuesday December 31, 2019 @07:58AM (#21920706)
Yeah, while Rust is paving the way for affine type systems among mainstream languages, and it already influenced design decisions on other system programming languages, including Swift (memory ownership manifest), it isn't the first on my list for UI or distributed computing applications.
Re:The Decade of Swift by skohan on Tuesday December 31, 2019 @10:17AM (#21921500)
Yeah to me Rust almost feels like the prototype for the next great programming language. There are a lot of great ideas there, but there are also a lot of awkward edges. Like what it accomplishes from a technical perspective is super impressive, but it would be great if somebody could synthesize all of those concepts behind a cleaner front-end which really nails the ergonomics.
Re:The Decade of Swift by steveklabnik on Tuesday December 31, 2019 @11:09AM (#21921991)
A few people have tossed around the idea of “what if Rust but drop the commitment to zero cost abstractions.” That’s probably our principle that causes the most ergonomic hit.

Of course, Rust won’t start taking that path, but if I were to start a new language today, that’s what it would look like.

Re:The Decade of Swift by skohan on Tuesday December 31, 2019 @02:39PM (#21923985)
Interesting. There was a really good talk at the last CPPCon by Chandler Carruth about how there is really no such thing as a zero-cost abstraction. The main point being, while you might be able to optimize against a runtime performance cost for abstractions, the cost will almost always be shifted to compile time, or to the cognitive burden on the developer.

It really makes me think there must be something like the first law of thermodynamics for logical complexity.

Re:The Decade of Swift by steveklabnik on Tuesday December 31, 2019 @06:21PM (#21925492)
Yeah, I haven’t watched the talk, but as you’d expect, Chandler has his head on straight. This is a common misconception: zero cost refers to runtime only. There’s always cost. Some people have started saying “zero overhead” instead to make it more clear, but it takes a while to change entrenched terminology.