-
Notifications
You must be signed in to change notification settings - Fork 89
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
Confirm missing constructor matchers #266
Comments
I doubt the last two are controversial as a "no", and I doubt the first two are controversial for a "yes". I'd lightly prefer to add the third one, but I don't feel strongly about it if anyone is strongly opposed. |
I'm skeptical about this. This allows devs to "match" an async function from a regular function, which is an implementation detail. It will cause a refactoring hazard (you should be able to switch between
I suggest adding a
Should we add a record&tuple matcher that only matches R&T? Or devs will do this? when (${Record} & { a, b }): console.log('record', a, b)
when (${Object} & { a, b }): console.log('record', a, b)
Should it do an internal slot check, a shape check, or a type coherence ( |
You can already check that - https://npmjs.com/is-async-function, https://npmjs.com/is-generator-function, etc - it's just not ergonomic. It's fair tho that perhaps we shouldn't encourage such checking. For Proxy, I suppose that makes sense, altho without a custom matcher it'll just check for I think devs will definitely do that. We'll also want prototype matchers for boxed records and tuples, just like I added for other boxed primitives. For Iterator, I would expect it to do an internal slot check - to only pass on things that |
While generally not recommended, there are scenarios where it can be nice to detect the difference between the two. For example, I once wrote a library that provided Considering that |
(from #263)
The text was updated successfully, but these errors were encountered: