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)
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.
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.
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.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.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.
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