-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should IndexValueToU64
use ToBigInt64
?
#85
Comments
The intent of Putting my spec lawyer hat on, though... I think the real question is how this interacts with WebIDL. The rules for conversion to WebIDL In our case, the third algorithm will pass BigInt values through unchanged, but will convert all other values to So that sucks. I think the above explanation is correct from a pedantic point of view, but generally we expect these IndexValue parameters to act like either If we want to stick very pedantically to all the specs, I think we have two options:
|
Thanks for the explanations, that all makes sense. I was not aware of the conversions rules that WebIDL specifies for So if (2) is "allowed" to do, then I think this would be the right solution. |
I don't see why it wouldn't be allowed, but it will no doubt be clumsy to specify. I'll ask some Mozilla folks for their opinion and then try and clean this up next week. |
A colleague had a nice idea for an elegant solution:
This would be similar to the |
The thing that At the very least, we need to preserve To be very pedantic, there is also the matter of memory limits actually being |
The JS API for WebAssembly.Memory and WebAssembly.Table objects should accept and return BigInt instead of Number for 64-bit memories and tables. It's still being discussed if we want to allow anything that can be converted to BigInt, or just BigInt itself, see WebAssembly/memory64#85. For now, we only accept BigInt as currently spec'ed. [email protected] Bug: 358381633 Change-Id: I5741aab5feec2a047320a355e3a5c5a0d4ccf673 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5898572 Reviewed-by: Eva Herencsárová <[email protected]> Commit-Queue: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/main@{#96362}
When implementing #75 in V8 I was wondering that the
IndexValueToU64
algorithm throws aTypeError
if the value is not a BigInt, instead of using theToBigInt64
algorithm that's also used inToWebAssemblyValue
.Any reason for this restriction, or should we be consistent there and accept anything that converts to a
BigInt64
according to that algorithm (in particular boolean values and string, but notably not Numbers).One difficulty with switching to
ToBigInt64
would be static typing on theIndexValue
type. Instead ofunsigned long or bigint
this would need to beunsigned long or object
I guess.The text was updated successfully, but these errors were encountered: