-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Implement Array prototype methods #36
Comments
@jasonwilliams For the array, what is a Javascript array represented as in Boa? From my investigation appears to be as an Object, so in the underlying Rust a hashmap mapping from index to value: is that accurate? Does that mean in Boa there's no Javascript difference between arrays and objects? Is that intentional or just because Array isn't implemented yet? Should we have an "Array" entry in the ValueData enum? |
That's a very good point, and yes, what you said is accurate. There is no Array primitive value in JavaScript, so we can't have an array datatype in the value enum. (for now) An Array is just an Object with a prototype of Array methods. V8 do some optimisations with arrays with a backing store: https://v8.dev/blog/fast-properties For now we just need to create a global constructor (Array), similar to what we do with strings. |
I think my main questions would likely be whether in order to implement the majority of Array prototype methods we should be converting to real Rust arrays/Vectors/etc under the covers or just using hashmaps for now? |
I would go hashmaps for now, you will hit way too many edge/corner cases if you try to convert them to Rust Vectors (i.e length shouldn't be counted). It's not the most performant but the most correct. We can fix speed later on with some optimisations. |
I'll take a look at |
@simonbrahan ok great |
I'd like to take a look at |
I'll like to work on |
@IovoslavIovchev can you put yourself on (or reply to) this issue jasonwilliams#176 @muskuloes same for jasonwilliams#177 |
Can I take |
A lot of these methods have already been implemented. Such as |
I updated the checklist. I noticed that the |
I will add documentation for it. |
Hey, like String the links are out of date now. Array can now be found here! |
I'd like to take a look at |
Go ahead! :D |
Also Since I did |
Hi all, I would like to work on |
Go ahead @davidmikulis :) |
The Pull Request for |
Should |
It shouldn't be implemented, since it's not in the spec. |
- adds array.prototype.splice - todo: fix stalls at certain testcases Closes boa-dev#36
- adds array.prototype.splice - todo: fix stalls at certain testcases Closes boa-dev#36
- adds array.prototype.splice - todo: fix stalls at certain testcases Closes boa-dev#36
- adds array.prototype.splice - todo: fix stalls at certain testcases Closes boa-dev#36
- adds array.prototype.splice - todo: fix stalls at certain testcases Closes boa-dev#36
We're still missing |
Yes, let's move localization yo a different issue. Is everything else done? |
Yep, everything else is implemented |
Closing in favour of #1562. |
Similar to #13 but for the Array
Implementation happens here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/array/mod.rs
The text was updated successfully, but these errors were encountered: