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 PR attempts to transform
Address
into an enum struct, but ultimately I believe the PR serves as a good showcase as to why we shouldn't...Primary goal
Avoid deprecation of 5-10 natives, whilst also keeping memory manipulation in plugin 'simple'.
Backward Compatibility
We're still runtime backward compatible. However we're not source backward compatible, operations like
view_as<int>
or++
will no longer work as they do not exist for enum structs. This is going to break compilation (to the best of our knowledge) of at least 200 plugins.What about PR #2196 ?
This is ultimately down to preferences. But after working on this, I believe it would be better to turn
Address
into an handle type, and overload the math operators. This might create problems regarding freeingAddress
, as plugin authors will get confused looking at older plugin source and not see in use thedelete
operator. But that outcome is still better, than wrecking havok on in the C++ api with an enum struct type that cannot be passed around extensions as easily as if it was an handle type. Something I could not forsee prior working on this.