News for hackers. Stuff that matters.
Re:Bugs that the Rust compiler catches for you by eptcyka on Thursday May 05, 2022 @06:16PM (#31278979)
I've seen people who state their love for Rust and then fail to explain the difference between passing an argument by value, reference or mutable reference.
Re:Bugs that the Rust compiler catches for you by carlmr on Thursday May 05, 2022 @06:47PM (#31279232)
I mean those are two separate things. Depending on how you code, Rust can be similarly high level as Python, make it much easier to design with types than C++ and has great package management with cargo.

You can find plenty of reasons to love Rust, without even getting to the technical details.

Re:Bugs that the Rust compiler catches for you by Thaxll on Thursday May 05, 2022 @07:11PM (#31279377)
> Rust can be similarly high level as Python

Not really, once you start something more complicated than hello world and start to try mutate things for example it get 100x more complicated that Python.

Re:Bugs that the Rust compiler catches for you by mamcx on Thursday May 05, 2022 @10:17PM (#31280516)
> Rust can be similarly high level as Python

In fact, Rust is MORE high level than python and most languages. That is exactly the borrow checker and all the other things are.

What is not, is being "simple" as python.

I code now full Rust and is the most productive language in my +20 years of this. My other picks: python, Delphi, FoxPro.

But is not productive exactly the same way python/delphi is. It has other axes of it. So in some task Python is unmatched and my main pick for scripting or brainstorming stuff. But Rust is the best at being overall productive.

Where is not (today) is lack of time/resources to be there (like GUIs. But honestly, nothing compare to FoxPro/delphi)...

Re:Bugs that the Rust compiler catches for you by girvo on Friday May 06, 2022 @12:45AM (#31281408)
> nothing compare to FoxPro/delphi

Amen. Every so often I boot up Lazarus and lament what could have been. Even the best web-dev frontend tools and frameworks do not come close.

I wonder if there is even a market for those sorts of tools today, though. I wasn't there for the decline of Delphi (and FoxPro, et al), so I've no real reference as to why they declined.

Re:Bugs that the Rust compiler catches for you by pjmlp on Friday May 06, 2022 @01:59AM (#31281775)
Qt, WPF, OutSystems,...

The tools are out there, even Delphi is still being sold and having a yearly conference in Germany.

They declined because only developers working at Fortune 500's get to pay for software.

When one only wants to have free beer, they get to have what the street bazaars can offer, instead of what the monks are using at the cathedral.

Re:Bugs that the Rust compiler catches for you by mamcx on Friday May 06, 2022 @01:58AM (#31281764)
I think all the stuff about nocode/lowcode/jupyter/etc say exist the market, but is going in a overly weird route, as if nobody know what this tools can do.

My dream is rebuild it: https://tablam.org!

Re:Bugs that the Rust compiler catches for you by kaba0 on Friday May 06, 2022 @05:43AM (#31283240)
No, this low-high level axis is not really “permeable”. You can maybe get as productive in rust as in some managed language at the first time you write the program. But later maintenance will simply drop your productivity as any refactor will likely alter your whole memory/ownership model and cause much more refactor recursively. Sure, you may say that “but it will be correct in the end while in python you have to hunt down the newly created bugs” and you might be right, but it is not a small price to pay. Managed languages let you get away with many many unanswered questions that you have to meticulously answer in case of low level ones, and I think it is a fair tradeoff depending on use-case. But as much as I love Rust, I won’t choose it for some database-mangling web service.
Re:Bugs that the Rust compiler catches for you by mamcx on Friday May 06, 2022 @05:02PM (#31289583)
> But later maintenance will simply drop your productivity as any refactor

This is very off weird take: Refactoring in Rust is one of their strengths as language (a major one!) where even VERY deep changes can be done in economical times.

Try the same in python is nearly impossible.

And I mean it: I fully rewritten all my app (a fairly complex niche eCommerce platform) to async and remade all things along it.

And I have A LOT of experience building, rewriting, and porting code; and Rust is the faster/more friendly to refactor both large or small in all my years.

However, I concede that get the knowledge with Rust have challenges and my first attempts at this (when doing my hobby https://tablam.org language) were miserable by lack of understanding, so it could be a factor.

Re:Bugs that the Rust compiler catches for you by DeathArrow on Friday May 06, 2022 @11:07AM (#31286049)
That's a valid criticism. While I can be much more productive in .NET with the help of the language, the compiler, the IDE, intellisense and copilot, looking at last Techempower benchmarks, Rust is still 1.6 faster.

I would use Rust for Web if I'd have to squeeze every bit of performance. Most of the of the time I don't have such need for performance.

Re:Bugs that the Rust compiler catches for you by DeathArrow on Friday May 06, 2022 @10:12AM (#31285321)
>Where is not (today) is lack of time/resources to be there (like GUIs. But honestly, nothing compare to FoxPro/delphi)

A few that come to my mind: C++ Builder, QT, Windows Forms, Xamarin, .NET MAUI.

Re:Bugs that the Rust compiler catches for you by ZephyrBlu on Thursday May 05, 2022 @07:57PM (#31279602)
I recently ported some Python to Rust and I actually did feel like a lot of the Rust code was pretty similar to Python.

Mutating things is mostly not that difficult, just add mut to the declaration and then &mut if you pass it around.

The most difficult thing was lifetimes.

E: borrows got a little tricky as well

Re:Bugs that the Rust compiler catches for you by carlmr on Friday May 06, 2022 @03:22AM (#31282321)
This is what I mean, I ported some Python code almost 1:1.

If you program in a functional way anyway, i.e. having data go through a series of filters, it is quite easy. But not all ways of programming are so easy to port to Rust.

Re:Bugs that the Rust compiler catches for you by melissalobos on Thursday May 05, 2022 @07:19PM (#31279423)
> start to try mutate things for example it get 100x more complicated that Python.

I don't know about 100x, using Box and mutexes it is pretty much as complicated or maybe 2x. If you want it to be efficient and leverage all of Rust then sure, but that wasn't what they were meaning.

Re:Bugs that the Rust compiler catches for you by Thaxll on Thursday May 05, 2022 @07:20PM (#31279432)
I don't see where in Rust you could have code that looks high level as in Python.
Re:Bugs that the Rust compiler catches for you by steveklabnik on Thursday May 05, 2022 @07:54PM (#31279588)
I did a random little comparison a while back https://news.ycombinator.com/item?id=22712441

One tiny program does not a realistic comparison make, of course. There’s tons of situations where either language can make things more complex than this example. But for basic tasks it’s not particularly complicated.

Re:Bugs that the Rust compiler catches for you by melissalobos on Thursday May 05, 2022 @07:22PM (#31279448)
https://actix.rs/

Look at the first example. It can be very similar.

Re:Bugs that the Rust compiler catches for you by jay_kyburz on Thursday May 05, 2022 @07:39PM (#31279523)
Haha, I think you might need to have another look at Python.
Re:Bugs that the Rust compiler catches for you by gpm on Thursday May 05, 2022 @08:23PM (#31279759)
Note that their example is something like making a hello world web server using twisted (or whatever the current async framework is) in python...

Strange example, but I suppose making the corresponding python more complex is one way to make them equivalent.

Re:Bugs that the Rust compiler catches for you by code_biologist on Thursday May 05, 2022 @08:54PM (#31279973)
For reference I'd say the "current async framework" is either Starlette [1] (low level) or FastAPI [2] (high level) for web stuff, and trio [3] for more stupidproof general async than twisted. IMHO of course!

[1] https://www.starlette.io/ [2] https://fastapi.tiangolo.com/ [3] https://trio.readthedocs.io/en/stable/

Re:Bugs that the Rust compiler catches for you by gpm on Thursday May 05, 2022 @08:56PM (#31279988)
Thanks, I appreciate it :)
Re:Bugs that the Rust compiler catches for you by DeathArrow on Friday May 06, 2022 @10:15AM (#31285378)
> Rust can be similarly high level as Python

What about Haskell? Can it be similarly high level as Haskell?

Re:Bugs that the Rust compiler catches for you by dsQTbR7Y5mRHnZv on Friday May 06, 2022 @08:46PM (#31291149)
This may be the closest thing I've personally seen: https://github.com/timvisee/advent-of-code-2021
Re:Bugs that the Rust compiler catches for you by ben0x539 on Thursday May 05, 2022 @07:57PM (#31279604)
people are allowed to love things without being experts or even particularly didactic about it lmao
Re:Bugs that the Rust compiler catches for you by eptcyka on Friday May 06, 2022 @12:46PM (#31287264)
I'm not sour about people enjoying things. Would you not feel peculiar about people who are really enthusiastic about a sous vide machine and use it to heat water for their tea? And when asked about their favourite cut of steak they like to sous vide, they'd stare blankly and proclaim that they are vegan? There's nothing wrong with using tools any which way you want, but the reason d'entre for Rust is fearless concurrency, and the distinction between borrowing and moving, with the addition of Send and Sync marker traits, is kind of the whole point of the langauge. I agree that it could still be a good language without these, but if it wasn't for these features, I doubt there'd be nearly as much enthusiasm behind it.
Re:Bugs that the Rust compiler catches for you by SolitudeSF on Friday May 06, 2022 @04:31AM (#31282809)
this not even close to expert knowledge, thats entry level
Re:Bugs that the Rust compiler catches for you by melissalobos on Thursday May 05, 2022 @08:54PM (#31279977)
Rust is slightly unusual in that most users/potential users of it tend to be very vocal about it. It would be nice if their knowledge matched their enthusiasm.
Re:Bugs that the Rust compiler catches for you by macintux on Friday May 06, 2022 @12:22AM (#31281289)
> Rust is slightly unusual in that most users/potential users of it tend to be very vocal about it.

Or that the only users you know about are vocal…because how would you know about the non-vocal ones?

Re:Bugs that the Rust compiler catches for you by ben0x539 on Thursday May 05, 2022 @09:01PM (#31280031)
let people enjoy things
Re:Bugs that the Rust compiler catches for you by ben0x539 on Thursday May 05, 2022 @09:01PM (#31280036)
like that's how you get the knowledge, you're enthusiastic about a thing and then spend a bunch of time with it and then you build up knowledge. it's healthier in that order.
Re:Bugs that the Rust compiler catches for you by Xunjin on Thursday May 05, 2022 @09:47PM (#31280321)
Ohhh please this is language wars, people don't want healthy arguments, they just want to pick a side and argue, just to earn internet points :D