Repository navigation
Conversation
|
According to Mozilla docs "In general, the only time Object.is special behavior towards zeros is likely to be of interest is in the pursuit of certain meta-programming schemes...suggested to avoid". |
|
This is looking great! Out traveling, but will try to review properly as soon as I can. |
| The `==` operator [is different in ReScript than Javascript](https://rescript-lang.org/docs/manual/latest/overview#boolean). Arrays, records and other non-primitives are equal if they have the same contents (deep equality). | ||
|
|
||
| In ReScript, the `===` operator performs a strict equality check, like Javascript, and is similar but not identical to `is` |
There was a problem hiding this comment.
Describing other functions and operators seem outside the scope of reference documentation. It will quickly become hard to maintain the documentation if it gets scattered across other definitions.
There was a problem hiding this comment.
Ok thanks for the feedback.
| ``` | ||
| */ | ||
| @val | ||
| external is: ('a, 'b) => bool = "Object.is" |
There was a problem hiding this comment.
I'm not sure this type signature makes sense. By definition you'd think that objects of different types wouldn't be considered identical, and you might as well weed that out at compile time.
There are of course exceptions, such as JSON-encoded primitives, but better to require explicitness than cater to convenience for weird edge cases I think.
I would therefore suggest this instead:
| external is: ('a, 'b) => bool = "Object.is" | |
| external is: ('a, 'a) => bool = "Object.is" |
There was a problem hiding this comment.
Ok I'll change it.
|
Git problems here. I broke the tests because I uploaded the type signature change but forgot to remove tests that compare different types. I don't know how to fix it. Sorry! Do I do a git pull rebase? VS Code wants me to do a Sync but it isn't working. Not sure what steps to do in VS Code. Don't want to lose work here. Or you can fix it if it is easy for you. |
test updates
|
Ok fixed it. |
|
Consolidated into #117 |
Documentation for Object.is. Also some tests mostly so I could verify how it all works. Took the liberty of documenting some of
==and===at the same time. Read through the Mozilla docs and tried to summarize.