Hacker News new | ask | show | jobs
by munificent 4376 days ago
> How well does Dart interact with JavaScript, especially libraries that are asynchronously loaded?

I'm not the best person to ask about JS interop, but I know it's something that other people on the team put a lot of effort into.

> I know that the Dart compiler is a whole-program optimizer, and I get the impression that Dart wants to own all the code on the page.

dart2js likes to have access to all of the Dart code while it's compiling, so it can do global optimization, but as far as I know, that doesn't affect JS interop. Talking to JS is all dynamically dispatched at runtime, so the compiler doesn't really care about it.

(We can also do deferred loading of Dart code now too, though I don't know the details.)

> What's Dart's story for interacting with tools like that?

Beyond the general JS interop story, I don't know if we've done anything specific there. I believe you should be able to talk to JS code even if it's loaded much later.