5 ms·
> Read up, you've missed a memo :-P. Plan for Harmony-era weak refs is to notify in next event loop turn. Got a link to the memo? I haven't heard about this on
by daurnimator 11y ago
> Read up, you've missed a memo :-P. Plan for Harmony-era weak refs is to notify in next event loop turn.
Got a link to the memo? I haven't heard about this one.
> Why do you need to manually deallocate a callback function passed to setTimeout?
One of my use cases is running lua in the browser. see lua.vm.js: https://kripken.github.io/lua.vm.js/repl.html https://kripken.github.io/lua.vm.js/repl.html
When you pass a lua function to a javascript function, I create a 'proxy' object that holds a reference to the function in the lua VM. Only if javascript tells me it's "done" with it can I drop the ref inside the lua VM.
- chadaustin 11y agoFWIW, this is exactly the same problem we had with making it possible for Embind to allow passing C++ functions into setTimeout. We'd need to synthesize a JavaScript function that holds a wrapper object for the C++ function, and that wrapper object would need to be deallocated when the timer is done. For general callbacks, this is a hard problem, and finalizers would provide a clean way to solve it.
- BrendanEich 11y agoSee, e.g., https://esdiscuss.org/topic/weak-event-listener#content-2 https://esdiscuss.org/topic/weak-event-listener#content-2 It's hard to find something fresh. I will stir the pot at the July TC39 meeting and get the committee on the record for weak refs with turn-delayed notification, or bust!
- daurnimator 11y ago> See, e.g., > https://esdiscuss.org/topic/weak-event-listener#content-2 https://esdiscuss.org/topic/weak-event-listener#content-2 > It's hard to find something fresh. I will stir the pot at the July TC39 meeting and get the committee on the record for weak refs with turn-delayed notification, or bust! As recently as September last year you told me it may happen... but with an indeterminate timeframe: https://mail.mozilla.org/pipermail/es-discuss/2014-September/039078.html https://mail.mozilla.org/pipermail/es-discuss/2014-September...
- BrendanEich 11y agoYeah, it needs an active champion. I'll poke likely champs.