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

#es-to-dictionary and #dictionary-to-es do not have reader-discernable titles #228

Open
equalsJeffH opened this issue Nov 7, 2016 · 10 comments

Comments

@equalsJeffH
Copy link

..and thus are difficult for readers to easily obtain a link to for use in another spec.

@domenic
Copy link
Member

domenic commented Nov 7, 2016

I guess this is a Bikeshed issue where it is not generating self-link anchors for <div algorithm>s. /cc @tabatkins

@tabatkins
Copy link
Contributor

It should have a <dfn> anyway; even if I started auto-genning IDs for algorithm containers and producing self-links, it would still be hard to link, as you'd have to open up WebIDL, click the self-link, copy the URL, then go back to your spec and hand-write an <a href> pointing to it.

@domenic
Copy link
Member

domenic commented Nov 7, 2016

The issue here is that Web IDL defines the general concept of "convert an ES value to an IDL value" with a <dfn>, then has a bunch of different algorithms giving specific ways to do that. I'm guessing @equalsJeffH wants to link to the specific algorithm. I guess maybe he should just be linking to https://heycam.github.io/webidl/#dfn-convert-ecmascript-to-idl-value and https://heycam.github.io/webidl/#dfn-convert-idl-to-ecmascript-value however.

@tabatkins
Copy link
Contributor

What's wrong with putting in more specific dfns too?

@equalsJeffH
Copy link
Author

@bzbarsky is suggesting that WebAuthn link directly to https://heycam.github.io/webidl/#dictionary-to-es -- which is the most precise thing for us to link to. I am simply noting that one cannot do this today without looking into WebIDL's index.bs source file, or getting the dictionary-to-es identifier from somewhere else.

I note that WebCrypto (which @bzbarsky cited as an example) does not actually link to the #dictionary-to-es algorithm, it says (in various places) only to..

Let ... be the result of converting ... to an ECMAScript Object, as defined by [WebIDL].

..maybe that is sufficient (it seems to essentially be what @domenic is suggesting).

@bzbarsky
Copy link
Collaborator

bzbarsky commented Nov 8, 2016

I always feel it's best to link to the most specific thing, instead of just generically linking to "WebIDL" and letting the poor reader try to figure out which part of WebIDL is relevant in this specific case. But maybe that's just me....

I agree that the "easter egg" nature of the #foo-to-es and #es-to-foo anchors in WebIDL is suboptimal. I guess I'm too used to having to view source to find which things are linkable in specs...

@annevk
Copy link
Member

annevk commented Nov 8, 2016

I agree with @tabatkins that IDL should just add more <dfn>s. One way to do it might be to add a heading before each type of conversion with dfn export set as attributes.

@tobie
Copy link
Collaborator

tobie commented Nov 9, 2016

Right. Planning to add DFNs to each algorithm.

Naming wise, let's do UpperCamelCase so we can then use these as:

let |r| be [=ESToDictionary=](|v|).

The conversion algorithms which convert ES values to specific IDL types could be named ESToDictionary(|v|), those which convert IDL types to values: DictionaryToES(|v|).

So the IDL Dictionary <-> ES value algorithms would be changed to:

<div algorithm>

    An ECMAScript value |V| is [=converted to an IDL value|converted=]
    to an IDL [=dictionary type=] value by
    running the <dfn id="es-to-dictionary" export>ESToDictionary</dfn> algorithm
    (where |D| is the [=dictionary=]):
    […]
</div>
<div algorithm>

    An IDL dictionary value |V| is [=converted to an ECMAScript value|converted=]
    to an ECMAScript <emu-val>Object</emu-val> value by
    running the <dfn id="dictionary-to-es" export>DictionaryToES</dfn> algorithm
    (where |D| is the [=dictionary=]):
    […]
</div>

If there's agreement around the plan + naming, I'll go ahead and submit a PR for these.

@tabatkins
Copy link
Contributor

Use abstract-op on those definitions to preserve the casing (as Anne said in IRC) and you're good.

@domenic
Copy link
Member

domenic commented Nov 9, 2016

I am leery of using this particular instance as the gateway to changing from normal English phrases as algorithm names, to ES-style PascalCaseAbstractOps. The web spec space has gotten along great with English phrases until now and I'm not sure how I feel about breaking that tradition so suddenly. But I don't care much so don't let me stop you.

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

No branches or pull requests

6 participants