-
Notifications
You must be signed in to change notification settings - Fork 660
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
instanceof Array can fail #1037
Comments
How widely supported is the thing you are suggesting? @rtfeldman, do you know anything about this? |
It was introduced in ES5: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray Unfortunately this is only one of many ways people can mess up the global execution environment in a way that could mess Elm up. Monkey patching is and always has been caveat emptor. I think we should leave the current behavior as-is on this one. |
Okay, I don't want to drop support for IE9 for this reason, and I suspect that's what we'd need to do here. Thanks @rtfeldman! |
I'm hacking on an Electron project which I'm trying to use elm for. In the electron code, one of my dependencies uses
vm.runInNewContext
which causes that code to have a different Array prototype which causes elm'sinstanceof
checks to fail (see nodejs/node-v0.x-archive#1277).Can elm use Arrays.isArray instead of instanceof checks?
It looks like it's probably just a matter of editing https://github.com/elm-lang/elm-compiler/blob/a9658ccb44cf3358991671b7abe02c4d87a31151/src/Generate/JavaScript/Port.hs#L87 and possibly adding a new helper. But I'm very new to elm (and don't have a great grounding in JS stuff anyway), so I figured I'd raise the issue before I sent a pull request.
The text was updated successfully, but these errors were encountered: