News for hackers. Stuff that matters.
Re:Rust Is a Scalable Language by kazinator on Tuesday March 28, 2023 @08:21PM (#35350179)
> How it works with Rust ...

You will be amazed to find that that's how it works with C, Pascal, Java ...

Types being declared in function headers and checked is 1960's technology.

Re:Rust Is a Scalable Language by iudqnolq on Tuesday March 28, 2023 @08:36PM (#35350336)
But Rust puts a unique amount of information into the types. This can get annoying sometimes, but it means typechecking better predicts correctness.

For example, a c header type might have an out parameter and an error code returned. The interaction between those two isn't specified in the type system.

I personally require discriminated unions (i.e. enums where each variant can hold its own type of data) before I consider a type system adequate.

Re:Rust Is a Scalable Language by kazinator on Tuesday March 28, 2023 @09:23PM (#35350782)
But that's way beyond someone coming from JS or Python, just being excited that there are types on the parameters and the compiler tells you when basic things are wrong.
Re:Rust Is a Scalable Language by iudqnolq on Tuesday March 28, 2023 @10:17PM (#35351337)
I personally came from JS to Java and got annoyed I had to do all this work specifying types but they gave me essentially no benefit.

Then I tried Rust and realized why types were good. (and then Kotlin)

Re:Rust Is a Scalable Language by xdavidliu on Tuesday March 28, 2023 @09:03PM (#35350587)
it’s not just the type checker; its the borrow checker, which prevents way more bugs than in C++ and is certainly not 1960s tech
Re:Rust Is a Scalable Language by kitkat_new on Tuesday March 28, 2023 @08:42PM (#35350404)
certainly not with C:

Manually managing memory has turned out to be error prone (for me) and can result in quite nasty to debug bugs (because the type system is lacking), only to mention the most important thing.

I think there is enough out there on C vs Rust, esp. because of the Linux kernel

That said, it was asked about Python (within the context of Rust), and I have limited experience with Pascal and Java, so I will leave it at that.

Re:Rust Is a Scalable Language by johnny22 on Tuesday March 28, 2023 @08:36PM (#35350331)
except the type system in C isn't that good.
Re:Rust Is a Scalable Language by amluto on Tuesday March 28, 2023 @11:48PM (#35352182)
That’s an understatement. If you see a function in a header like:

    char *func(char *in, size_t len);
It’s anybody’s guess what the actual input type is, not to mention the ownership or lifetime of the output.
Re:Rust Is a Scalable Language by kazinator on Tuesday March 28, 2023 @11:49PM (#35352192)
HN now supports backslash escapes for asterisks (which, unescaped, are markup notation for italics).