Skip to content
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

fix: Maximum call stack size exceeded (#40) #64

Closed

Conversation

milahu
Copy link
Contributor

@milahu milahu commented Sep 6, 2021

part of sveltejs/svelte#6716

start fixing #40 and sveltejs/svelte#4694

@Conduitry
Copy link
Collaborator

We don't want to be mutating Array.prototype to add our own new method there. This should either be implemented as a regular function that accepts the array as an argument, or it should use reassignments and concat.

@milahu milahu force-pushed the fix-maximum-call-stack-size-exceeded branch from d016094 to 4605d5b Compare September 10, 2021 19:37
@milahu
Copy link
Contributor Author

milahu commented Sep 10, 2021

This should either be implemented as a regular function that accepts the array as an argument

yepp

// original
a.push(...b, c)

// replaceMethod = "pushArray"
a.pushArray(b, [c])

// current version
// replaceMethod = "pushArrayNoMethod"
pushArray(a, b, [c])

or it should use reassignments and concat.

thats usually slower

code-red has no eslint, so the patched code looks a bit ugly

Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could possibly tweak the naming a bit, but otherwise lgtm

@@ -0,0 +1,11 @@
export function push_array(thisArray, ...otherList) {
Copy link
Contributor

@benmccann benmccann Jan 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be this_array and other_list according to Rich's coding convention. though the variable name is perhaps a bit ambiguous - is it "another list" or a "list of other"? I might have the function signature be something like:

export function push_array(array, ...additional_arrays) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherList is a list of otherArray ... maybe call it otherArrayList?

example call:

push_array(thisArray, otherArray1, otherArray2, otherArray3)

@milahu
Copy link
Contributor Author

milahu commented Jan 30, 2022

closing for #71 - thanks all : )

@milahu milahu closed this Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants