ADR 0001: No Compound Assignment in Beamtalk
Status
Implemented (2026-02-08)
Context
Beamtalk initially planned to support compound assignment operators (+=, -=, *=, /=) as documented in various design documents.
However, compound assignment breaks Smalltalk's message-passing paradigm:
x + 1is a message send (receiver:x, selector:+, argument:1)x += 1is NOT a message send—it's a special syntactic form that mutates in place- In Smalltalk, everything (except assignment and return) is a message send
- Compound assignment exists "outside" the object model and cannot be overridden or customized
Decision
Do not support compound assignment operators (+=, -=, *=, /=) in Beamtalk.
Instead, use explicit assignment with message sends:
// Not supported:
x += 1
self.value *= 2
// Beamtalk way:
x := x + 1 // explicit message send
self.value := self.value * 2
Consequences
Positive
-
Smalltalk purity: Maintains message-passing paradigm.
x + 1remains a pure message send that composes with other operations. -
Simpler language: Fewer special syntactic forms. Everything (except
:=and^) is a message send. -
Self-documenting code:
x := x + 1makes the operation explicit and clear. -
Enables Erlang operator alignment: Frees up
/=for use as a comparison operator (see ADR 0002). -
Consistency: All operations follow the same pattern: message send, then assignment.
Negative
-
More verbose:
x := x + 1is longer thanx += 1(but this is the Smalltalk way). -
Breaking change: Need to update all existing documentation and examples that use compound assignment.
-
Developer expectations: Modern developers familiar with C-family languages expect compound assignment to exist.
Neutral
- Field access repetition:
self.value := self.value + 1repeatsself.value, but this is standard in Smalltalk.
Migration Path
-
Update documentation:
docs/beamtalk-syntax-rationale.md- Remove compound assignment sectiondocs/beamtalk-language-features.md- Replace all+=,-=,*=,/=examples- All other docs with compound assignment examples
-
Update implementation:
- Ensure compound assignment is not parsed (verify parser rejects it)
- Update tests to use explicit assignment
References
- Smalltalk-80 Blue Book: Assignment and message sending conventions
docs/beamtalk-syntax-rationale.md: Original design rationale- ADR 0002: Use Erlang comparison operators directly (depends on this decision)
- Discussion date: 2026-02-03
Notes
This decision prioritizes:
- Smalltalk message-passing purity over syntactic convenience
- Language simplicity over C-family conventions
The slight increase in verbosity (x := x + 1 vs x += 1) is acceptable given Beamtalk's goal of being Smalltalk-inspired with a pure message-passing model.