Hacker News new | ask | show | jobs
by zozbot234 1732 days ago
Thing is, the constraints that make mutability and side effects "safe" are pretty much indistinguishable from functional programming. You can opt out of those in Rust via "internal mutability", but that comes with a corresponding increase in complexity.
1 comments

I don't think Rust can enforce referential transparency, nor does it have any focus on doing this manually. But I would say referential transparency is one the most important properties in functional programming, if not even the most distinguishing property.

Referential transparency is the one feature that makes reasoning about a program easy. You can think about referential transparent programs purely in the substitution model. You can move referential transparent expressions freely around as you please.

You can't think of a Rust program this way. It's inherently procedural.

Rust gets a lot of things quite right! But it's not a FP language. It's a better C. It's about shoveling bits and bytes around, as safely and efficient as possible.