6.4 Dot
expression | ||||||||||||
| ||||||||||||
expression | ||||||||||||
| ||||||||||||
repetition | ||||||||||||
| ||||||||||||
| ||||||||||||
| ||||||||||||
|
See also use_static.
3
> p.x
1
> p
Posn(1, 20)
The := ~cas old_expr ~to assignment form is limited to a target_expr.id that statically refers to a mutable field of an object. It updates the field only when the current field value is === to the result of old_expr and only if the value can be atomically replaced with the result of expr. Otherwise, the current value is left intact. In this mode, the assignment expression produces a Boolean result: #true if the value was replaced, and #false if not. Beware that on some platforms, a “spurious” failure can produce a #false result and unchanged content even when the current content matches the result of old_expr. See also memory.order_acquire and memory.order_release.