I hereby claim:
- I am bakkot on github.
- I am bakkot (https://keybase.io/bakkot) on keybase.
- I have a public key whose fingerprint is FD44 B8F2 65AC E177 48C5 23C8 A07A 119B 504C 8D8F
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
let frame = document.body.appendChild(document.createElement('iframe')); | |
frame.addEventListener('load', ()=>{ | |
let w = frame.contentWindow; | |
let evt; | |
w.addEventListener('error', e=>{evt = e;}); | |
let scr = w.document.createElement('script'); | |
scr.text = 'throw 42;'; | |
var p = () => console.log(f); | |
{ | |
p(); // undefined | |
console.log(f); // function f(){} | |
f = 1; | |
p(); // undefined | |
console.log(f); // 1 | |
d28ebe6d Normative: Specify Date.UTC when called with fewer than two arguments (#642)
0916d813 Normative: Use explicit comparison to compare two lists in Valid Chosen Reads
90ed6ce2 Normative: Call NumberToRawBytes instead of the conversion operation to get the byte values list in Atomics.compareExchange
7949fae4 Normative: Only check for undefined count parameter in Atomics.wake, because it's not marked as optional
a4d0e490 Normative: Unconditionally call ToNumber on the timeout parameter in Atomics.wait, because it's not marked as optional
Or: two-color functions.
The problem: async
is infectious.
There's a famous essay about this, called What Color is your Function, which I recommend reading.
For example, say you're writing a bundler. It needs to fetch resources, but is agnostic to how those resources are fetched, so it takes a readResource
function from its caller. In some contexts the caller might have those resources synchronously available; in others not. That is, caller might have a synchronous readResource
which returns a resource immediately, or an async readResources
which returns a promise for a resource, which will need to be unwrapped with await
.
'use strict'; | |
let { parseArgs } = require('util'); | |
let mainOptions = { help: { type: 'boolean', short: 'h' } }; | |
let subCommands = { | |
__proto__: null, | |
foo: fooCommand, | |
bar: barCommand, | |
}; |
(function x(){"use strict"; x = 1;}()); // TypeError | |
(function x(){x = 1; return x !== 1;}()); // write fails silently; function returns true | |
(function x(){"use strict"; x = (function(){throw 0;})();})() // Error 0 | |
// These three lines rely on ES6. | |
(function x(){const x = 1;})() // No-op. In particular, not a redeclaration of x. | |
(function (){"use strict"; const x = 1; x = 2;})() // TypeError | |
(function (){const x = 1; x = 2;})() // TypeError. contrast (function x(){x = 2;}()); |
import fs from 'fs'; | |
import { inspect } from 'util'; | |
import path from 'path'; | |
import { fileURLToPath } from 'url'; | |
let __dirname = path.dirname(fileURLToPath(import.meta.url)); | |
let usersToUpgrade = ['@justingrant:matrix.org']; | |
let targetPowerLevel = 50; | |
let roomId = '!nSLHQtIRJQxUJbEuGt:matrix.org'; // editor channel; this ID can be obtained from room settings -> Advanced |