Rust to Nim: A Comparison

Hey, thanks again @leorize for the info.

Here's another question hopefully you can answer.

This snippet

left_half.setLen left_half.len - 1; left_half.add right_half

can't be written like this

left_half.setLen(left_half.len - 1).add right_half

or this

(left_half.setLen left_half.len - 1).add right_half

because left_half.setLen left_half.len - 1 doesn't immediately return its value, the way most languages do. Is this behavior planned to be changed so you can do at least the latter version? I would think it should be easy to write the compiler to know that (xx operation) wants the results returned, not a void type.

I was really getting into Nim up to a couple of years ago, but for things not strictly related to the language itself (that I won't get into here), I got turned off to it. Also, coming from Ruby, where programmer happiness was the primary goal for Matz, all these little quirks, and continual resistance to document them and listen to its users to fix them, soured me to it. (Really, do you have to be so different to force people to do x [mod,div,and,or] y vs x [%, /, &, |] y). Nim has useful benefits for its niches it could excel in, but its devs, (especially Araq) seem more into creating something they like, and force users to conform to it, than to create a language that is easy and enjoyable for people to use. My intent here is not to rag on Nim, but merely to provide you feedback to make it better.

Again, you have been very helpful, and I've learned allot from your examples. I just wish that were more generally true about Nim.