You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I think most of the warnings would/should still apply, I think you could get -mostly- timely destruction for them.
The trick would be to keep a WeakMap or WeakSet of the javascript functions proxying to the subref on the JS side, plus a hash or Hash::Util::FieldHash of the subrefs themselves on the perl side, and to periodically check to see if the WeakXXX entry has gone away and release the subref if so.
Sadly I don't immediately see a way to convince QuickJS to do a full GC, so you'll be dependent on its decision for that, but since it's a hybrid refcounting + mark&sweep GC (and perl programmers tend to reflexively -not- create circular references if we can avoid it ;) there seems like a decent chance that the function object will go away at a sensibly early moment - or at least often enough that at least with a little care such a feature would be worth turning on for quite a lot of users.
The question of whether this is worth the additional complexity is left as an exercise to the maintainer - but nonetheless, I'm pretty sure it would -work- at least.
(I am not currently using this module but was having a look around; it -is- now filed in my brain as the first thing to try when I need something in this space, but that doesn't mean you should listen to me if your actual users don't care ;)
(I have a project in mind that absolutely would end up using this, hence looking around, but whether the yak ordering will result in me writing it any time soon is unknown)
The text was updated successfully, but these errors were encountered:
While I think most of the warnings would/should still apply, I think you could get -mostly- timely destruction for them.
The trick would be to keep a WeakMap or WeakSet of the javascript functions proxying to the subref on the JS side, plus a hash or Hash::Util::FieldHash of the subrefs themselves on the perl side, and to periodically check to see if the WeakXXX entry has gone away and release the subref if so.
Sadly I don't immediately see a way to convince QuickJS to do a full GC, so you'll be dependent on its decision for that, but since it's a hybrid refcounting + mark&sweep GC (and perl programmers tend to reflexively -not- create circular references if we can avoid it ;) there seems like a decent chance that the function object will go away at a sensibly early moment - or at least often enough that at least with a little care such a feature would be worth turning on for quite a lot of users.
The question of whether this is worth the additional complexity is left as an exercise to the maintainer - but nonetheless, I'm pretty sure it would -work- at least.
(I am not currently using this module but was having a look around; it -is- now filed in my brain as the first thing to try when I need something in this space, but that doesn't mean you should listen to me if your actual users don't care ;)
(I have a project in mind that absolutely would end up using this, hence looking around, but whether the yak ordering will result in me writing it any time soon is unknown)
The text was updated successfully, but these errors were encountered: