Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Session idea: sample implementations in js/ts #20

Open
marcoscaceres opened this issue Apr 20, 2021 · 7 comments
Open

Session idea: sample implementations in js/ts #20

marcoscaceres opened this issue Apr 20, 2021 · 7 comments

Comments

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Apr 20, 2021

From #17, it might be fun to have a session that explores how reference implementations of a spec can be written in JS or TS. And how this is very useful for verification of a spec.

@ljharb
Copy link

ljharb commented Apr 20, 2021

https://npmjs.com/es-abstract is ecma262's Abstract Operations implemented in JS; you can look at http://npmjs.com/~es-shims to find a lot of shims/polyfills implemented using it.

@ericprud
Copy link
Contributor

I'd call these example implementations unless you intend them to supersede the spec.

@ljharb
Copy link

ljharb commented Apr 21, 2021

@ericprud what is the difference between an "example" or a "reference" implementation? Isn't any implementation that conforms to the conformance tests a reference implementation? Why would something being a "reference implementation" supersede the spec?

@ericprud
Copy link
Contributor

Technically, or at least originally, a "reference implementation" is essentially a spec. This means that every other implementation MUST be bug-compatible with it. It's a somewhat arcane distinction these days when people don't intend that interpretation, but I find it best to use "example implementation" or "sample implementation", which has the benefit of clarifying that the spec does indeed have primacy.

@marcoscaceres
Copy link
Contributor Author

Ah, I was wondering the same thing. With specs that target browsers, it's been my experience that "reference implementations" have generally been throwaway JS implementations. Eventually browsers implementations supplant the reference implementation (with their own quirky engine behaviour and priv/sec improvements). But @ericprud is right that the name of these things is somewhat confusing.

@ericprud ericprud changed the title Session idea: reference implementations in js/ts Session idea: sample implementations in js/ts Apr 22, 2021
@ericprud
Copy link
Contributor

Meta: I renamed the issue to "sample implementations" to capture apparent consensus not to use "reference".

I vaguely prefer "sample" over "example" because it seems to elevate it above an example which might be less comprehensive. At any rate, we get to invent terms of art to guide practiced readers more efficiently through docs.

@marcoscaceres
Copy link
Contributor Author

"Prototype implementation" might also work 🤔. I don't have a strong opinion.

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

No branches or pull requests

3 participants