-
Notifications
You must be signed in to change notification settings - Fork 23
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
Handle AssemblyScript's typed Array syntax #62
Comments
Hello!
You are welcome! Glad that you are enjoying using it! 😄
Ah! So yeah I noticed you are using an array of a number type, vs. a TypedArray. So, if I'm not mistaken, an Array in JS / AS is more of a dictionary-like list object, whereas a TypedArray is a specific type of view over a binary buffer. Thus, they are very similiar, but fundamentally do different things (especially in conjunction on how they are represented in memory). So unfortunately, they can't be used interchangeably. So I would recommend just using a And at this time, as-bind only supports TypedArrays, and not normal arrays yet :( . Let me know if this makes sense! Thanks! 😄 |
That makes total sense indeed, thanks for the clarification on the semantics! I was wondering if there was a way to explicitly raise an error when one tries to call a function that declares an |
You are welcome! 😄
Ah! That's a good idea for the interem. As this seems to be a common hiccup people experience, for example #28 . Adding an error for unsupported types until we support them would be great! Let's keep this issue open so we can implement that 😄 |
Excellent! Thanks! |
@Y-- Oh yay! Thank you for wanting to pick this one up! 😄 So I'm not too sure about the reflection, but I'm sure @dcodeIO or @MaxGraey would know :) And the way I would have implemented it, was to add |
closed by #66 😄 🎉 |
@torch2424 I think this issue remains: there is still no compatibility between an |
Oops! My apologies, I'll re-open than! 😄 @Y-- |
Hi!
Thanks again for this great project!
I was playing with some AssemblyScript code and was surprised by the difference between
i8[]
andInt8Array
.For example, let's say I have:
Then when I execute it like this:
I get unrelated numbers like
44381
.Now, I'm not very familiar with AssemblyScript so I am not sure if this should simply be forbidden (explicit runtime error?) or correctly handled. I was able to reproduce that behavior in AssemblyScript directly:
Then:
So the question is: do we have any way to know if the exported function argument's types?
I've started a branch here https://github.com/sutoiku/as-bind/tree/as-typed-arrays with tests that reproduces the behavior:
Let me know your thoughts.
Thanks!
Y.
The text was updated successfully, but these errors were encountered: