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.
This is the big change for the next major release of Rune.
Value
type will be made private, so there will be no way to match over variants.Value
doesn't clone the interior value, effectively meaning that numbers and other primitives are no longer implicitly copy.Internals of
Value
are privateThis means that we can internally use any signature, giving us more freedom in how the language is evolved in the future. So we eat the breakage now instead.
As a result of this change,
Shared
is private.All values are structurally shared
For converting to and from
Value
, you should prefer to userune::to_value
andrune::from_value
.The second change is necessary to implement many future compiler optimizations, such as this:
Preferably a compiler should convert this to:
However, in a dynamic language the semantics of the tuple assignment depends on whether
a
and / orb
are copy types. The assignment would either copy the underlying values or structurally share the values. This matters if such assignments are later mutated.This change ensures that the language has a single semantic; all values unless they are explicitly cloned with the
clone
method are structurally shared. Even numerical values.