Generalised plusequals
10 hours ago
- #syntax-innovation
- #assignment-operators
- #programming-language
- Introduces a language feature using 'alt' keyword for reassignment, similar to 'x += 1' but more generalized
- Proposes new infix operators ']=' and '.=' for list and attribute reassignment, comparing to Python equivalents
- Demonstrates nested data reassignment with 'alt' to update values without mutation, e.g., 'alt l[1][1].age.=9'
- Shows sugar expansion for 'alt' statements to reveal intermediate steps, preventing original mutation
- Describes infixing binary functions with tildes, allowing operations like 'alt l~push~5' for appending to lists