Skip to content

Commit

Permalink
TODOs and mention null
Browse files Browse the repository at this point in the history
  • Loading branch information
tlively committed Mar 23, 2023
1 parent 38fcf6e commit bd24853
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion proposals/gc/MVP-JS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ passed into WebAssembly in a location that expects an internal reference, the
`ToWebAssemblyValue` algorithm will implicitly call `extern.internalize` on it
to get an internal reference. `ToWebAssemblyValue` will then cast the internal
reference to the specific expected type, and if that fails, it will throw a
`TypeError`.
`TypeError`. JS `null` converts to and is converted from WebAssembly `null`
values.

In JS hosts, `extern.internalize` will behave differently depending on the JS
value that is being internalized:
Expand All @@ -61,5 +62,10 @@ internal reference value that is being externalized:

- If the value is an i31 reference, convert it to a JS number.
- If the value is a struct or array reference, create a new JS wrapper for it.
_TODO: re-use existing wrapper instead of get bidirectional identity
preservation._
- Otherwise if the reference is an internalized host reference, return the
original external host reference.

_TODO: avoid having to patch the behavior of `extern.internalize` and
`extern.internalize` by converting to/from JS numbers separately._

0 comments on commit bd24853

Please sign in to comment.