webr
webr copied to clipboard
When Typescript 5.2 is released, consider updating and using the new `using` keyword.
The new using
keyword could give us a nicer way to manage R object memory. What is currently,
try {
const foo = await webR.evalR('foo');
} finally {
webR.destroy(foo);
}
could become something like,
{
await using foo = webR.evalR('foo');
// Do something with foo...
} // Automatically destroyed!
The finaliser is defined in a special symbol property of the object foo
, so IIUC we would "just" need to include a new property in the generic RObject
proxy object hooks.
oooh nice!