News for hackers. Stuff that matters.
Re:Don't write Rust like it's Java by niederman on Friday August 09, 2024 @05:56AM (#41200330)
> Remember that great feature of Rust being memory safe? It comes at the cost of not being able to easily “inject” something that implements a trait.

This is not at all the reason. The real reason is that Rust chooses to make the runtime overhead required for dynamic typing and heap allocation explicit, not anything to do with memory safety.

Re:Don't write Rust like it's Java by kaba0 on Friday August 09, 2024 @08:21AM (#41201114)
Well, java won’t have any overhead in many cases (e.g. only single implementation), as the JIT compiler will do its job.