Hacker News new | past | comments | ask | show | jobs | submit login

Treating a session or IO object as mutable seems perfectly reasonable. Problems arise only when multiple parts of a program mutate these without coordination.

Even everyday decisions like whether to copy an array passed to a constructor can be fraught with danger. Is the caller going to retain a reference and mutate the array after I check invariants? This simple yet intractable problem lurks in every imperative language except Rust.

Channels in Go are another great example. CSP is a sound approach for safe concurrency, yet the Go language offers no assurance that references passed over a channel are exclusive to the receiving goroutine.

I don't see how languages like Ruby or Python or Go could incrementally add a borrow checker. It would break too much. Returning to other programming languages after internalizing Rust compiler warnings is really eye-opening.

I have not tried Crystal. I also haven't written OCaml, though I did dabble in F#. Rust's match expression was definitely inspired by OCaml.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: