wtfrmyinitials
Joined 10 years ago
Karma
195
Submissions
73
Member since
May 30
Joined 10 years ago
> import foo from 'foo';
> await foo.bar();
You only have to `await foo.bar()` if foo.bar was an async function already, the module system is irrelevant. You would still need to await it even if it was `require()`'d in. import baz from 'baz';
baz.foo();
Works just fine, no `await` necessary. > await Promise.all([
> import('other'),
> import('stuff'),
> ]);
Of course these have to be awaited, at this point you're explicitly trying to load new code while the program is running. It's no different than any other kind of async IO. > import yet from 'more-stuff';
I assume this is included to imply that loading `yet` is blocked by the `await Promise.all` above it to show that import statements can run after module resolution. If this was your intent you are mistaken, that import statement is still resolved before execution begins. // main.js
console.log('a')
await new Promise(res => setTimeout(res, 1000))
console.log('b')
import { foo } from "./foo.js";
// foo.js
export function foo() {
}
console.log('c')
Results in c
a
[one second pause]
b
> Yes, an import statement is [semantically] blocking. But even so it’s important to know that it’s performing async I/O.No, it really isn't. From the POV of the application code it's irrelevant. This is trivially proven by the existence of module bundlers which convert non-dynamic `import` statements into one big file that doesn't do anything asynchronous to initialize.
(edit: fighting with formatting)
> No. Like I said above, Stratechery is a business, and it’s the quality of my audience that makes this deal possible. Moreover, Stratechery has never promised to be ad-free: what I am selling is access to my paid content, and it’s on me to make that content worthwhile.
This is disappointing. As a long-time Stratechery subscriber, and someone who cares a little too much about where my time and attention is spent, I go out of my way to pay for the ad-free tier for almost all the content I regularly consume.
After years of reading Ben’s arguments in favor of advertising, I was finally starting to come around to his point of view. This announcement, though, leaves a sour taste in my mouth.
I think Ben’s own distinction between lean-in and lean-back engagement is particularly relevant here. When I’m mindlessly scrolling Instagram, an ad for an interesting product is just as welcome a diversion as the wedding photos of some long-forgotten acquaintance. But when I’m reading Stratechery, I’m deliberately giving a subject my attention, hoping to come away with some new insight. An ad for Stripe in the middle of that experience serves as a distraction and decreases value rather than increasing it.
And, in the spirit of Ben’s own disclosures, I should mention that I recently joined a company that competes with Stripe. Make of that what you will.