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:
https://www.googleapis.com/download/storage/v1/b/chromium-browser-continuous/o/Win%2F100056%2Fchrome-win32.zip?generation=1&alt=media |
I hereby claim:
To claim this, I am signing this object:
var p = () => console.log(f); | |
{ | |
p(); // undefined | |
console.log(f); // function f(){} | |
f = 1; | |
p(); // undefined | |
console.log(f); // 1 | |
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;'; | |
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, | |
}; |
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 |
'use strict'; | |
// see https://github.com/C2SP/C2SP/blob/94012bb895565ab4259263d241a9549c4174ccb0/chacha8rand/chacha8rand.go | |
// TODO compare against https://github.com/golang/go/blob/9177e12ccc2115e44de824ae7247ace88617c29a/src/internal/chacha8rand/chacha8_generic.go | |
// should be the same but it's a bit hard to compare | |
// this is not optimized | |
function uint32(n) { | |
return n >>> 0; | |
} |