Uh oh!
There was an error while loading. Please reload this page.
Add 'types' module to core - #44
Conversation
addaleax
commented
Sep 22, 2016
One may want to add, according to the most recent
(I assume the plan is keeping the list more or less up to date with what V8 offers?) |
evanlucas
commented
Sep 22, 2016
@addaleax thanks! Yes, the plan was to keep the list updated with what v8 offers. |
jasnell
commented
Sep 22, 2016
While I'm fine with this in general, I do have some concerns:
|
cjihrig
commented
Sep 22, 2016
I'm in favor of exposing |
Fishrock123
commented
Sep 26, 2016
I really think we should just talk to people from TC39 about putting this in the language itself...? |
evanlucas
commented
Sep 26, 2016
@Fishrock123 while I agree 100%, I would assume the timeline on that would be quite a bit longer than if we were to go this route for the time being. |
williamkapke
commented
Sep 26, 2016
This would be cool. Getting it in the language would certainly be preferable. ... but I'd really like having it. |
addaleax
commented
Sep 26, 2016
Maybe it’s worth to ping @nodejs/chakracore? |
jasnell
commented
Sep 26, 2016
Putting such a proposal forward is not difficult. Convincing the commitee On Monday, September 26, 2016, Anna Henningsen notifications@github.com
|
kunalspathak
commented
Sep 26, 2016
Chakra would still need to shim out calls to |
Fishrock123
commented
Sep 28, 2016
@jasnell same reasons as we use them? I'm not seeing why there's much difference. |
jasnell
commented
Sep 28, 2016
That doesn't always fly. For instance, there's extremely little reason why a browser developer would need |
jasnell
commented
Sep 28, 2016
That said, since I'm here this week anyway I'll ask :-) |
Fishrock123
commented
Sep 28, 2016
Then why would we want to publicly expose it ourselves? There is a reason there are deprecated in the docs. |
jasnell
commented
Sep 28, 2016
|
cjihrig
commented
Sep 28, 2016
Yes, supporting a function like |
jasnell
commented
Sep 28, 2016
Ok, here's an idea for a proposal to TC-39. There are already examples of similar types of methods (e.g. |
kunalspathak
commented
Sep 28, 2016
cjihrig
commented
Sep 28, 2016
+1 to a proposal to TC-39. In the event that it is rejected, or takes a long time to play out, it is still useful for Node to provide this though. |
mikeal
commented
Sep 28, 2016
It's worth noting that TC39 isn't done adding new types so part of this proposal would also be to include similar "is" methods on all new types so we don't continue to see this going forward. |
Probably worth noting the TC39 hasn't yet outlined the bar to meet for new built-ins (it's on a todo), so it's a bit hit-n-miss for what sticks and what doesn't. |
jasnell
commented
Sep 28, 2016
@jdalton ... it definitely would be good to have those constraints but we can make do for the time being by just bringing the proposal in and seeing how it goes. |
jasnell
commented
Sep 28, 2016
@cjihrig ... for a TC-39 proposal to make progress we'd have to provide an implementation so doing something in parallel makes sense. We'd just need to be deliberate about how we introduce the APIs to make sure they match up with what is being proposed. |
disnet
commented
Sep 28, 2016
Note that TC39 considered |
jasnell
commented
Sep 28, 2016
@disnet ... yes, I'm not convinced that |
At the very least an official list of built-in language types would be useful so as to decide what we should or shouldn't do in this potential space if it comes down to it. (May already exist) |
evanlucas
commented
Sep 29, 2016
One use case I can think of for isProxy (and a lot of the others) is for formatting or logging |
jasnell
commented
Oct 6, 2016
Here is the start of a proposal for TC-39: https://github.com/jasnell/proposal-istypes |
jasnell
commented
Oct 10, 2016
See: tc39/proposals#29 |
| done via a native addon [(v8is)](https://github.com/evanlucas/v8is), it | ||
| requires that a compiler be installed on the consumer's machine. | ||
| We can expose these methods using currently by using `v8::Value`. |
There was a problem hiding this comment.
We can expose these methods currently by using v8::Value
styfle
commented
Mar 19, 2018
I haven't seen any movement on this. @jasnell It looks like the TC39 proposal is still stage 0? 😕 |
evanlucas
commented
Mar 20, 2018
Closing as this has been superseded by nodejs/node#18415 |
Description
This proposal is to add a builtin module that provides a way to determine
whether the passed argument is of a particular type. Although this can be
done via a native addon (v8is), it
requires that a compiler be installed on the consumer's machine.
We can expose these methods using currently by using
v8::Value.The
util.is*functions are currently deprecated in the documentation. Thisproposal will add an upgrade path to those currently using those functions.
Proof-of-concept
A proof-of-concept (does not include docs or a full test suite yet) can be found at:
https://github.com/evanlucas/node/tree/types
I know some have expressed interest in this and I wanted to extend a formal proposal for implementing.
/cc @cjihrig@jasnell@jdalton