whatwg / infra

Infra Standard
https://infra.spec.whatwg.org/
Other
118 stars 95 forks source link

Formalize lambdas #311

Open annevk opened 4 years ago

annevk commented 4 years ago

In https://github.com/whatwg/html/pull/5560#discussion_r436160750 @inexorabletash suggests formalizing lambdas, e.g.:

Let steps be to fire an event x at y.

inexorabletash commented 4 years ago

Example from Indexed DB, text suggested by @domenic

Let operation be an algorithm to run store a record into an object store with store, clone, key, and no-overwrite flag.

inexorabletash commented 4 years ago

Streams uses e.g.

Let pullAlgorithm be an algorithm that returns a promise resolved with undefined.

and:

...set cancelAlgorithm to an algorithm which takes an argument reason and returns the result of invoking underlyingSourceDict["cancel"] with argument list « reason » and callback this value underlyingSource.

jyasskin commented 1 year ago

Is this a duplicate of #206?

In any case, this and #206 should be defined in the same section, and the definition should say what happens if they refer to variables from the surrounding scope. (I think we usually assume they capture references so that people can make closures.)