-
Notifications
You must be signed in to change notification settings - Fork 165
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
Shepherd: difference between "record" and "record type" #233
Comments
This blocks whatwg/fetch#412 by the way. |
Bikeshed's bleeding edge is broken right now, see: speced/bikeshed#867. |
I don't know. We seem to have this for some types but not all. Unless there's a good reason to have both, we should probably clean it up. |
@jyasskin was this copypasta or intentional? |
A record is a thing of that a key-value mapping. A record type is a type whose values are records. The difference is the same as the difference between "long" and "5". |
I don't really get the analogy. 5 is an instance of a long, sure. But "record" is not an instance of a record type. A specific record, sure, but the word record by itself is not. Anyway, I'm going to submit a PR to at least export mappings since that's blocking Fetch from using records. |
I didn't close this intentionally. I'd still like to figure out the difference. Also, if they indeed turn out to be distinct somehow we should probably export both of them. |
I think "a record" would be "some instance of some record type", at least for me. "the record" would be "a specific instance of some record type". I'd be interested in how this is actually being used in context. |
https://github.com/whatwg/fetch/pull/412/files "if object is a record, then for each mapping (key, value) in object" |
Anyway, you're right, and ECMAScript does the same kind of thing describing its types: https://tc39.github.io/ecma262/#sec-list-and-record-specification-type. Although ECMAScript does not seem to use a distinct So do we want a |
In that case the intent is "if object is an instance of the record type", just like saying "if object is a Headers object" would mean "if object is an instance of the Headers interface type" or so.... |
Just to be clear, the language I used in whatwg/fetch#412 is adapted from the language in Web IDL spec itself. For instance:
That is pretty much analogous to other IDL types as well.
In this case, |
Yeah, I think your PR is fine. I'm mostly wondering about the distinction between types and instances, but maybe the distinction only matters if there's syntax for types. E.g., the URL Standard defines URLs (not talking about the IDL interface here). Arguably they're a type, but we don't really make that distinction explicit. |
The other thing here is that what IDL has as definition for "record" is the heading that says "record types". So even if there's a valid distinction between the two, the current setup doesn't really illustrate that I think. |
I don't understand https://heycam.github.io/webidl/#idl-record. The heading is a dictionary definition (not exported). Then we have record type (exported). Then we have mappings (not exported, for=record).
What is the difference between record and record type? Why is mappings for=record and not for="record type"?
And can we export mappings?
I was trying to clean up some of this, but got
The text was updated successfully, but these errors were encountered: