Improvements around collections and the use of them #314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implicit conversions back to primitive integers
A big pain when using std containers with subspace is converting explicitly back to primitive types.
But we really don't want subspace types to convert back to primitive types and fall out of subspace land, like adding a primitive to a subspace numeric should always result in a subspace numeric or a compile error (if the primitive is too big).
Getting this right required some serious heroics though where for every builtin binary operator that takes primitive types, we need to replace that with a function of our own if one of the two parameters is a subspace numeric. Then, either perform the action if it's valid, or delete the function if it's not, to avoid falling back to a conversion into a primitive type.
Slice invalidations
While writing docs we uncovered a bug which was caused by Vec returning a reference to itself for a Slice, but then the Slice shared the Vec's length field, so mutating the Vec also mutated the Slice. So Vec now converts to a Slice by constructing a Slice not just a reference.