Skip to content

Conversation

@dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Feb 15, 2020

There has been a change a while ago that tried to unify the ArrayBufferView interface, but it turned out that the changes there are unsafe. In particular:

  • Array<T> must not expose .buffer since it can resize automatically, leading to use-after-free scenarios in the worst case.
  • Array<T> does not have a .byteLength property.

The only sensible solution there is to use distinct @unsafe fields for the ABV interface, with actual implementations providing safe getters.

Original breaking PR: #865
Related docs issue: https://github.com/AssemblyScript/docs/pull/7

@dcodeIO
Copy link
Member Author

dcodeIO commented Feb 15, 2020

Perhaps a better strategy would be to make Array<T> not extend ArrayBufferView anymore, just as in TS, so we can have proper members on ABVs.

@MaxGraey
Copy link
Member

Yeah agree, we discussed about this in the past btw

@dcodeIO dcodeIO closed this Feb 26, 2020
@dcodeIO dcodeIO deleted the fix-arraybufferview branch March 15, 2020 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants