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

Separate out exported abstract ops from internal ones #372

Closed
domenic opened this issue Jul 2, 2015 · 10 comments · Fixed by #1073
Closed

Separate out exported abstract ops from internal ones #372

domenic opened this issue Jul 2, 2015 · 10 comments · Fixed by #1073
Labels
editorial Changes that do not affect how the standard is understood

Comments

@domenic
Copy link
Member

domenic commented Jul 2, 2015

Ideally, other specs should only refer to a few of our abstract ops, e.g.:

  • AcquireReadableStreamReader ( stream )
  • CloseReadableStream ( stream )
  • EnqueueInReadableStream ( stream, chunk )
  • ErrorReadableStream ( stream, e )
  • IsReadableStream ( x )
  • IsReadableStreamLocked ( stream )
  • TeeReadableStream ( stream, shouldClone )

plus maybe a few more. Others are "implementation details", e.g. FinishClosingReadableStream ( stream ) or RequestReadableStreamPull ( stream ) or similar. Additionally, for each of the above, there are some "usage details" that are important. E.g. see the intro of https://streams.spec.whatwg.org/#enqueue-in-readable-stream

A few strategies:

  • Separate sections, e.g. exported abstract ops and internal abstract ops
  • Some kind of tag, like that proposed for Notate abstract ops that can throw #371
  • A separate "for other specifications" section describing the usage of exported abstract ops
    • Pro: authors of other specs probably don't care to actually read the details of e.g. EnqueueInReadableStream
    • Con: duplication; keeping in sync; is this normative or non-normative?
  • Some kind of toggle switch that gives you a "for other spec authors" view, which hides any non-exported abstract ops (and maybe hides the algorithms for the exported ones?)

Thoughts appreciated. Probably especially from @annevk as Fetch editor.

@domenic domenic added the editorial Changes that do not affect how the standard is understood label Jul 2, 2015
@annevk
Copy link
Member

annevk commented Jul 2, 2015

I think ideally you can find out from the name which is private and which is public. Would prefixing internal methods with "@" be too weird?

@domenic
Copy link
Member Author

domenic commented Jul 2, 2015

That seems pretty weird but maybe it will grow on me. You like it better than the tag idea?

@annevk
Copy link
Member

annevk commented Jul 2, 2015

A bit, the tags might not make it into other specifications.

@domenic
Copy link
Member Author

domenic commented Jul 2, 2015

Yeah, they wouldn't... but if everyone behaves themselves, neither would any @-prefixed internal methods :P

@annevk
Copy link
Member

annevk commented Jul 2, 2015

This has often confused me with ECMAScript too. And is a problem with most specifications today. A lot of algorithms and not clear which are reusable and which are not. Glad you're leading the way.

@tyoshino
Copy link
Member

tyoshino commented Aug 3, 2015

Any of separate section, tag, prefixing work for me. Regardless we put tag/prefix or not, grouping into two sections would improve readability, I guess.

domenic added a commit that referenced this issue Aug 27, 2015
That is, other specifications are supposed to use it, similar to ErrorReadableStream and CloseReadableStream and others. (Related: #372.) See https://github.com/yutakahirano/fetch-with-streams/pull/54/files#diff-04c6e90faac2675aa89e2176d2eec7d8R94.
@domenic
Copy link
Member Author

domenic commented Aug 4, 2016

One way of doing this is to move stuff like https://fetch.spec.whatwg.org/#streams into the spec. That way we achieve a few things at once:

  • Let streams define how to manipulate streams, instead of letting Fetch do it
  • Give people the ability to use English to invoke these operations, instead of function call syntax, since that seems to be important
  • Make it clear what we expect other specs to invoke

@annevk
Copy link
Member

annevk commented Aug 4, 2016

I would be happy to use abstract operations in Fetch in due course. Though English might be a tad more readable at times.

domenic pushed a commit that referenced this issue Aug 4, 2016
This may break some incoming links from Fetch, but they were already conceptually broken. We will fix that mismatch in #372.
@annevk
Copy link
Member

annevk commented Aug 25, 2020

What's the plan here now that Streams is using IDL?

@domenic
Copy link
Member Author

domenic commented Aug 25, 2020

Roughly the same, and much closer to the top of my to-do list. My current plan is:

  • Survey Fetch, Service Workers, Native Filesystem, Serial API, etc. to find out what they need.
  • Wrap everything up into English prose-style algorithms and indirections in a tentative PR. (Including removing export="" on abstract ops.)
  • Send tentative PRs to those specs and get feedback. (Including, for Fetch, removing https://fetch.spec.whatwg.org/#streams.)
  • Merge them all at once.

domenic added a commit that referenced this issue Aug 26, 2020
domenic added a commit that referenced this issue Sep 14, 2020
yutakahirano pushed a commit to yutakahirano/streams that referenced this issue Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Changes that do not affect how the standard is understood
Development

Successfully merging a pull request may close this issue.

3 participants