Creator of Ante here. It's just a term I made up for mutation which does not change the "shape" of data in a way that can invalidate any of that data. Mutating a struct or tuple field, even if nested, is stable for example, but mutating an optional string to None is not because you may be dropping a string which there may be a reference to somewhere.
I see, so would it would only be relevant to unions, or would adding a new node to a linked list or pushing another element in a dynamic array or setting a pointer to null also count?
As far as I understand, every change to indirections (pointers) is “shape unstable”, as it the update invalidates the old value, which causes every reference into that to be dangling (rather than merely modified).
Adding a new node at the end of a linked list, or more generally setting an unset pointer, would technically be shape-stable as you can’t have a reference into nothing. Generally pushing an element in a dynamic array is not shape-stable (the array can need to reallocate), although there would be workarounds e.g. a push which fails on lack of capacity would be shape-stable. Some sort of hybrid (e.g. rrb) would also work as extension consists of adding new node (possibly re-rooting the tree) but does not invalidate existing nodes.
Creator of Ante here. It's just a term I made up for mutation which does not change the "shape" of data in a way that can invalidate any of that data. Mutating a struct or tuple field, even if nested, is stable for example, but mutating an optional string to None is not because you may be dropping a string which there may be a reference to somewhere.
I see, so would it would only be relevant to unions, or would adding a new node to a linked list or pushing another element in a dynamic array or setting a pointer to null also count?
As far as I understand, every change to indirections (pointers) is “shape unstable”, as it the update invalidates the old value, which causes every reference into that to be dangling (rather than merely modified).
Adding a new node at the end of a linked list, or more generally setting an unset pointer, would technically be shape-stable as you can’t have a reference into nothing. Generally pushing an element in a dynamic array is not shape-stable (the array can need to reallocate), although there would be workarounds e.g. a push which fails on lack of capacity would be shape-stable. Some sort of hybrid (e.g. rrb) would also work as extension consists of adding new node (possibly re-rooting the tree) but does not invalidate existing nodes.