The Array()
constructor is not spec compliant
#816
Labels
bug
Something isn't working
builtins
PRs and Issues related to builtins/intrinsics
good first issue
Good for newcomers
Hacktoberfest
Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Milestone
Describe the bug
The
Array()
constructor is not spec compliant. When creating a huge array, for example:This will try to actually insert 50k properties in the array. The spec says otherwise. It should only set the length, and should not create any other property.
This happens because our implementation is not spec compliant. We should have 3 private constructor methods (
construct_array
,construct_array_length
andconstruct_array_items
), and they should be called from theconstructor
method. In each of them, we should have information about the exact spec, and use the actual spec implementation.This means we will need to create an
array_create
function, that will follow this spec.A similar thing should be done with the rest of the
Array
prototype methods.The text was updated successfully, but these errors were encountered: