Description
We currently have a Finalizable
interface that serves two purposes:
- It keeps objects alive until the end of the syntactic scope.
- It can have
NativeFinalizer
s attached.
Due to (2), we disallow sending objects implementing Finalizable
to other isolates. As that that will most likely be an error.
However, when attaching finalizers via the dart_api.h
, we also need the behavior of (1), and we actually want to send objects to other isolates (that's why we resorted to using finalizers from the dart_api.h
in the first place.)
We should introduce another marker interface that only has behavior 1.
Maybe the interfaces should even be related.
Ready for bike shedding on the name:
a. KeepAlive
b. IsolateGroupFinalizable
The marker interface should probably live in dart:ffi
as well. Because it's mostly used when sending objects via FFI with Handle
s. Also it would enable relating the two interfaces, helping with documentation. But I can be convinced of other options.
Use case: