tc39 / proposal-weakrefs

WeakRefs
https://tc39.github.io/proposal-weakrefs/
409 stars 41 forks source link

Rename FinalizationGroup to FinalizationRegistry (or other name?) #180

Closed littledan closed 4 years ago

littledan commented 4 years ago

When discussing "independent lifetimes" for FinalizationGroups, @kmiller68 suggested that a different name could imply independent lifetimes more clearly. An "observer" seems to be more reliable than what FinalizationGroups provide. @erights suggested that FinalizationRegistry makes it clear that, when the registry goes away, we can't expect anything from it (moreso than FinalizationHandler). @ljharb agreed that FinalizationRegistry makes more sense than FinalizationGroup, given that there's only one callback (not a group of callbacks).

Does anyone have any concerns about renaming to FinalizationRegistry? Or any other name to propose?

ljharb commented 4 years ago

Although, it's not a registry of finalizers; it's a registry of objects for one finalizer :-/

littledan commented 4 years ago

@ljharb It's hard for me to interpret this comment. Do you have a name you'd suggest? Are you OK with FinalizationRegistry?

ljharb commented 4 years ago

After some more discussion, FinalizationRegistry seems to be acceptable - it's a registry of an object (with an optional heldValue and an optional unregister token), for finalization, and if the registry dies, i'd expect the finalization not to be performed.

littledan commented 4 years ago

In TC39, we agreed to "contingent consensus" on the name FinalizationRegistry: We're tentatively going with this name, but anyone who develops concerns should raise them on this issue. The understanding is that some implementations may ship the name FinalizationRegistry soon, if no concerns are heard.

littledan commented 4 years ago

The name change has landed weeks ago, and I haven't heard any concerns, so I'm closing this issue as resolved.