News for hackers. Stuff that matters.
Re:Rust – A hard decision pays off by tlrobinson on Wednesday August 24, 2022 @03:48PM (#32584800)
> I find that static typing means I can be more productive, because type errors are caught straight away

I agree completely. I feel like there’s a pretty common arc among programmers:

1. learn to program using verbose statically typed languages

2. discover fun dynamically typed languages, eschew statically typed languages

3. discover dynamically typed languages are a shitshow for large real-world projects

4. re-discover fun/less verbose statically typed languages that make working on large projects tolerable

Re:Rust – A hard decision pays off by tralarpa on Wednesday August 24, 2022 @06:25PM (#32586614)
I hate that some universities teach dynamically typed languages as first language in their curriculum. I think for CS students the first language should be as "strict" (not in the mathematical sense) as possible, so the student is forced to think very carefully what is going where. This is of course a controversial opinion, especially among proponents of SICP (which is, in my opinion, not a good book for beginners. Yes, downvote me).

(Obviously, I am talking about CS students here, not about the general public who just want to learn what writing a program means)

Re:Rust – A hard decision pays off by xhevahir on Wednesday August 24, 2022 @08:22PM (#32587722)
What language do you recommend for beginners?
Re:Rust – A hard decision pays off by throwaway894345 on Wednesday August 24, 2022 @08:28PM (#32587766)
I think Go would make a pretty good language for beginners, but I haven't tested that theory. TypeScript might be the safer bet, especially since you can run it in the browser and see things, which is probably somewhat more gratifying than printing text to a console.
Re:Rust – A hard decision pays off by manholio on Thursday August 25, 2022 @05:27AM (#32591463)
I would go on a limb and say Rust (or more specifically, a limited dialect of it) could become a good language for beginners if:

- the compiler had better life time inference, so that you wouldn't need to annotate simple functions and introduce beginners to complex issues related to lifetimes, i.e it should "seem" to work like python, initially.

- better learning resources for absolute beginners are developed, step by step tutorial, an easy to install full IDE with friendly error messages etc.

Re:Rust – A hard decision pays off by einpoklum on Wednesday August 24, 2022 @06:08PM (#32586433)
About no. 4: That often translates into noticing C++ has gotten `auto` in C++11 with a later improvement in C++14:

  auto x { get_something_complicated() };
or

  foo(int x) -> auto {
      return get_something_complicated(bar(x));
  }
     
so it's less "not-fun" these days.
Re:Rust – A hard decision pays off by throwaway2037 on Wednesday August 24, 2022 @07:43PM (#32587413)
I feel the same. Java and C# have an equivalent called 'var'. Unless the scope is tiny, I always avoid it. Also, in Java when you create a lambda, it is possible to exclude the parameter types.

    foo(x) -> get_something_complicated(bar(x))
It is not good for readability in large source bases.
Re:Rust – A hard decision pays off by einpoklum on Friday August 26, 2022 @03:26AM (#32604234)
With C++ lambdas, it's similar, but the syntax is a bit uglier:

  [](auto&& x) { return get_something_complicated(bar(x)); }
and you can decide whether you want a value (no &'s), an lvalue reference (&), or a forwarding reference (&&). I think with C++20 you can also use a concept instead of auto for a constrained parameter type.
Re:Rust – A hard decision pays off by amelius on Wednesday August 24, 2022 @05:39PM (#32586123)
Except keep in mind that Rust adds more constraints than your typical statically typed language.

It is still more fun and efficient to program in a language that is garbage collected and statically typed.

Re:Rust – A hard decision pays off by linsomniac on Wednesday August 24, 2022 @08:34PM (#32587795)
The thing I like about Python is that I can decide, even on a line-by-line basis, but more likely on a program by program basis, if it makes sense to be type oblivious, or type checked.
Re:Rust – A hard decision pays off by rjh29 on Thursday August 25, 2022 @07:18AM (#32592179)
Exactly. For one-off scripts or code you might throw away, there is nothing wrong with skipping the types.