The union safety problem is especially disturbing for a different
reason: it precludes linked lists (and similar structures) that are
threaded through their respective objects.

Consider a mutable union containing a doubly linked list element. The
union can be mutated as a whole. If the type tag of the union changes
this can create a safety problem because neighboring link elements no
longer point to a link element.

However, there is a higher-level problem here. Imagine that we re-assign
the union to a new value having the same tag. Note that all of the
linked list pointers are now validly typed, but they aren't in a linked
list here. There is no type violation, but there is an invariant
violation.

This raises two problems:

1. Can we avoid the need for such constructs? I'm not sure.
2. If not, do we now need to introduce a notion of construction,
destruction, and overloading of assignment? I would like to avoid this.

We are going to proceed by pushing hard on (1) to see what happens. We
currently see exactly one critical data structure in Coyotos for which
this presents a problem, and there is an alternative implementation.

shap

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to