简体   繁体   中英

Does compiling to javascript preclude dart adding weak references?

I'm disappointed that dart doesn't feature weak references.

Is there something about compiling to a language which doesn't offer weak references which makes it impossible?

Yes.

In order to support weak references, you need a way to interact with or override the GC.
That is fundamentally impossible in Javascript.

Dart wants to compile to performant JavaScript. That's why it needs to skip certain features (tail calls, for example). And I'd even argue that weak references are a bad idea anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM