-
Notifications
You must be signed in to change notification settings - Fork 67
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
h$isObject is implemented incorrectly in jsbits/utils.js
.
#68
Comments
According to http://stackoverflow.com/a/8511350/2104107 and http://stackoverflow.com/a/22482737/2104107, function h$isObject(o) {
return o !== null && typeof o === 'object';
} seems correct. Since functions are considered objects in javascript specification, the following function could be considered correct, too. function h$isObject(o) {
return o !== null && (typeof o === 'object' || typeof o === 'function');
} |
Is there an example use case where the current implementation is problematic? It seems like it would be best to mirror the behaviour of JavaScript in this case unless there is a reason not to. |
I stopped programming for money. I'm transitioning into art. Nowadays, I rarely ever write code except when I write some haskell code in XMonad and small command line programs. Thus, I also stopped caring about user interface, javascript, and GHCJS. That said, I don't know what you mean by mirroring the behavior of javascript. |
Ah.
Nice.
Doh!
Good point. I guess I just was following the pattern that the other Also reading through that post in more detail suggests |
Let's have a look at
ghcjs-base/jsbits/utils.js
Lines 26 to 28 in 9d89e12
typeof(null) is
'object'
, thus you should replace that with something likeI don't know if
instanceof Object
is totally accurate yet. I'll add comments on this.The text was updated successfully, but these errors were encountered: