Skip to content
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

What is an intrinsic? #1540

Open
jmdyck opened this issue May 14, 2019 · 8 comments
Open

What is an intrinsic? #1540

jmdyck opened this issue May 14, 2019 · 8 comments
Labels

Comments

@jmdyck
Copy link
Collaborator

jmdyck commented May 14, 2019

The spec doesn't really define the term "intrinsic".

It does define "well-known intrinsic":

built-in objects that are explicitly referenced by the algorithms of this specification

which suggests that "intrinsic" simply means "built-in object".

Alternatively, one could reasonably infer that an intrinsic is any object created by the CreateIntrinsics operation. I believe that all such objects are built-in objects, but the converse is not quite true. That is, the set of objects created by CreateIntrinsics is a subset of the built-in objects (for a given realm). For example, each invocation of MakeArgGetter creates a built-in function object, and that happens outside of CreateIntrinsics.

So: is a function created by MakeArgGetter an intrinsic? My guess is that it isn't, i.e. that the latter inference is the correct one. Not a big deal, but it would be nice to know.


While I'm in the neighborhood, 6.1.7.4 Well-Known Intrinsic Objects says:

Well-known intrinsics are built-in objects that are explicitly referenced by the algorithms of this specification and which usually have realm-specific identities. Unless otherwise specified each intrinsic object actually corresponds to a set of similar objects, one per realm.

I'm dubious about the "usually" and "Unless otherwise specified". Are there any (well-known) intrinsic objects that aren't tied to a specific realm? CreateIntrinsics doesn't seem to think so.

@domenic
Copy link
Member

domenic commented May 14, 2019

Perhaps it'd be good to first step back, and determine what normative impact any definition of "intrinsic" would have?

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 14, 2019

Oh, probably no impact that anyone would pay attention to.

@allenwb
Copy link
Member

allenwb commented May 14, 2019

see related discussion WRT a PR to the Who We Work repository

tc39/how-we-work#64

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 15, 2019

That link is a 404 for me. (I guess it's a private repo.)

@ljharb
Copy link
Member

ljharb commented May 15, 2019

It is.

@jmdyck
Copy link
Collaborator Author

jmdyck commented May 15, 2019

So could someone with access to that repo summarize (without violating whatever's private about it) how that PR relates to or informs this issue? (Or should I pretend it wasn't mentioned?)

@erights
Copy link

erights commented May 15, 2019

I'll just repost my own last contributions without quotations or names of other people:

Ok, I am satisfied that "intrinsics" should be defined such that includes all the primordials. "intrinsics" also includes the global object, which "primordials" excludes, but that's manageable.

Aside from the global object, does "intrinsics" exclude what "primordials" must exclude: objects provided by the host, like window, document, require, and all objects reachable (only) from them?

For example, if "intrinsic" might be taken to include elements of the "web platform" defined by whatwg/w3c, then we still need the separate term "primordial". If "intrinsic" clearly excludes these, then yes, I think we can drop "primordials" in favor of "intrinsics other than the global object".

"standard intrinsics apart from the global object" is a mouthful. But at this point I agree that some locution involving "intrinsic", if a good one can be found, is better than introducing "primordial" as a seemingly new term.

@allenwb
Copy link
Member

allenwb commented May 15, 2019

Nothing particularly "private" there, it's just happened to be an issue attached to the private "How we work" repository.

Here is the essence of my part of the conversation (the preceded Mark's quote):

@erights Yes, All the objects that are created prior to execution of any code in a realm are "intrinsics".

See CreateIntrinsics() in particularly step 13 that says

Set fields of intrinsics with the values listed in Table 7 that have not already been handled above. The field names are the names listed in column one of the table. The value of each field is a new object value fully and recursively populated with property values as defined by the specification of each object in clauses 18-26. ...

The items listed in Table 7 are the Well Known Intrinsics that need to be directly referenced by the specification text. It includes among others all the objects that are specific as values of properties of the global object.

Other objects recursively specified in clauses 18-26 are also intrinsics, but are not "Well known" because there aren't any specification algorithms that need to directly refer to them.

The distinction between "intrinsic objects" and "well known intrinsic objects" probably should be clarified. Basically, the well known intrinics were always intended to be a subset of the intrinsics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants