A quarter-baked language experiment proposes an alt keyword to generalize compound assignment, enabling immutable deep-struct updates with terse syntax like alt l[1][1].age.=9.
Key Takeaways
alt x + 1 desugars to x = x + 1; the keyword generalizes +=-style reassignment to any infix operator.
Two new infix operators .= (field replace, equivalent to dataclasses.replace) and ]= (index replace) enable immutable nested updates without mutation.
Deep nested update alt l[1][1].age.=9 expands to a chain of temporary variable rebindings, leaving the original structure unchanged.
Tilde syntax allows plain binary functions as infix operators: alt l~push~5 appends without mutating.
Compile-time plan: treat all data as immutable in semantics but use mutable structures under the hood when safe, similar in spirit to Rust’s borrow checker.
Hacker News Comment Review
The single substantive comment points directly to Haskell lenses (the lens package) as the established answer to the author’s own question about Haskell equivalents for property traversal and nested updates.
Notable Comments
@flebron: Haskell’s lens package and its traversal abstractions already cover this design space; links to hackage.haskell.org/package/lens and the lens tutorial.