News for hackers. Stuff that matters.
Re:Teach Yourself Programming in Ten Years (1998) by zozbot234 on Tuesday January 16, 2024 @06:33AM (#39012135)
Yes but that's the thing, if you pass everything by value or read-only reference you don't have to deal with the borrow checker, and that's quite acceptable when you're first writing code. That's why I think Rust is almost a FP language in disguise with imperative features added after-the-fact - and it could be taught as such.
Re:Teach Yourself Programming in Ten Years (1998) by diarrhea on Tuesday January 16, 2024 @08:31AM (#39013051)
You’re not wrong, but precluding tons of concepts not suitable for beginners. “Just .copy() everything” shouldn’t need to be mentioned in an introductory book.
Re:Teach Yourself Programming in Ten Years (1998) by josephg on Tuesday January 16, 2024 @08:52AM (#39013250)
Yep; and cloning boxed objects everywhere often leads to slower rust code than the equivalent javascript or Go. And if you only teach a subset of rust without references, people can't read code snippets online, or most of the standard library documentation.

In comparison, Python, Go, Javascript and C# are all much easier to teach and leave students more able to make real software.

Re:Teach Yourself Programming in Ten Years (1998) by fl0ki on Tuesday January 16, 2024 @10:56AM (#39014763)
This only gets you so far. In today's software landscape, somebody is going to want to hit a HTTP JSON API to automate something in their second week, and they'll have a really rough time with how async Rust works today. Try explaining to a total beginner why they need Arc<Mutex<T>> and why the payload struct needs to be :Send+Sync+'static.

For all of Go's faults, "just send it over a channel bro" is easy to explain for trivial cases even if it often risks deadlocks and data races. To avoid the worst risks of this kind of code, Rust makes even trivial cases a big exercise. Go has an opportunity here to become more resistant to bugs without becoming less simple, but resistance to bugs doesn't appear to be a priority even for the Go team itself (e.g. even recently https://github.com/golang/go/issues/64474 )