News for hackers. Stuff that matters.
Re:Using Rust at a Startup: A Cautionary Tale by creata on Tuesday November 22, 2022 @09:14PM (#33714283)
> Rust is considerably more productive [than Python]

Can you expand on this, please?

Re:Using Rust at a Startup: A Cautionary Tale by pclmulqdq on Tuesday November 22, 2022 @09:28PM (#33714402)
Python is extremely easy to write, but hell to read. Rust code tends to be very easy to read.

On a big project, you are going to be reading a lot more code than you are going to be writing.

Re:Using Rust at a Startup: A Cautionary Tale by jasonjmcghee on Wednesday November 23, 2022 @01:01AM (#33715760)
I've read and written a huge amount of python and rust, also a fan of rust and don't find it particular difficult to read.

As long as there is proper linting, both should be readable.

That being said, python is about the simplest language there is to read.

Of course if you have many times nested and improperly indented list comprehensions- sure that gets confusing. But that should be fixed with proper linting (black on its own should do it)

Curious about the examples you've seen that were difficult to parse!

Re:Using Rust at a Startup: A Cautionary Tale by Casperin on Wednesday November 23, 2022 @09:36AM (#33719600)
I don't necessarily agree that Python overall is difficult to read, but one thing that seems to get my every time is the

    foo = x if y else z
Re:Using Rust at a Startup: A Cautionary Tale by jasonjmcghee on Wednesday November 23, 2022 @11:22AM (#33721158)
I see where you're coming from.

Many languages support the ternary operator, where it would be:

  foo = y ? x : z
Which "feels better" but I think that's because I learned ternaries first.

Some languages like Rust and Kotlin do support assignment of an if statement like

  foo = if (y) { x } else { z }
And I think that's a good step, as it doesn't need to introduce new syntax, just allows assignment of "blocks"
Re:Using Rust at a Startup: A Cautionary Tale by Casperin on Wednesday November 23, 2022 @08:19PM (#33726753)
Yes. It requires that `if else` can be used as expressions, which for some reason in most languages that can not.

In the beginning of doing Rust I was missing the ternary operator, but now I couldn't care less.

    foo = if y { x } else { y }
Works well :-)
Re:Using Rust at a Startup: A Cautionary Tale by Casperin on Wednesday November 23, 2022 @10:08AM (#33720038)
I can. I work on a ~20k loc Python service as well as a ~10k loc Rust service. The Rust service is only half the size, but the problem space is many times more complex.

Whenever I work on the Python service I feel like I'm working in clay. Like, everything kind of sort of works. It won't at first, but then you just poke at it with a stick until it does. In Rust, it works or you're told exactly why it doesn't and then you fix it.

I change a struct and the compiler provides me with a list of places that need updating.

I have many reasons (mypy, type system, testing, venv, python 2), but really the big one is rust's superior type system as well as general tooling (lsp is way better, cargo and clippy are phenomenal).

Re:Using Rust at a Startup: A Cautionary Tale by insanitybit on Wednesday November 23, 2022 @01:26PM (#33722777)
I'll just link you to the last time I responded to this: https://old.reddit.com/r/rust/comments/xbqdzi/anyone_use_rus...