- Author: Tab Atkins-Bittner
- Created: 2025-06-30
In general, we put "semantics" into HTML, and "presentation" into CSS.
Living Document. J. S. Choi, 2018-12.
The [WHATWG Fetch Standard][] contains several examples of using the DOM fetch
function, resolving its promises into values, then processing the values in
various ways. These examples may become more easily readable with smart pipelines.
tldr:
if(<boolean-expr>)) and removed the if(...) part from the match() syntax.ident when <matcher> binding-matcher form, to match its usage in destructuring./foo/ when <matcher> for consistency (and removed the named bindings for simplicity).foo(<matchers>))I think the rules for infinite-lookahead would be:
This gives us infinite lookahead, with arbitrary mixing of properties and selectors, with only three compromises:
We've been deadlocked for a while on the pipeline operator proposal, for a few reasons. Partially it's just low implementor interest, as this is fundamentally just syntactic sugar, but also because there are three competing proposals and the proponents of each haven't been convinced by the others yet.
In this essay I hope to briefly outline the problem space, summarize the three proposals, and talk about what's gained/lost by each of them. (Spoiler: they're all nearly identical; we're arguing over very small potatoes.)
On Sep 1 2022, Yulia and I had a VC to get past our misunderstandings/disagreements about pattern matching in a high-bandwidth fashion.
The high-level summary is that Yulia has three requests, all of which I think are reasonable. In order of complexity:
Right now, custom matchers have to be done via an object with a Symbol.matcher key. The matcher function can be written as a plain boolean function now, but you still need that object wrapper, which is annoying as it prevents existing boolean functions from being easily used. Ideally you'd be able to write when(${someFunc}) and have it work exactly like when(${{[Symbol.matcher]: someFunc}}) does in today's spec.
The blocker for this is that we currently define Function.prototype[Symbol.matcher] to essentially do an instanceof check, so JS classes can be used by default: when(${MyClass}) will match if the matchable is an instance of MyClass or a subclass, wi
| // This is a decorated version of <https://github.com/tc39/proposal-pattern-matching#custom-matcher-protocol-interpolations> | |
| // A predefined ADT decorator. | |
| // Use it on static "constructor" methods only. | |
| // Pass an extractor function, to produce a pattern-matching value. | |
| // The instance must have an [ADT.kind] property | |
| // set to the constructor method used. | |
| const ADT = (valExtractor=()=>null) => (_, {methodName, isStatic, kind, addInitializer}) => { | |
| if(kind == "method" && isStatic) { | |
| addInitializer(function(){ |