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
With the advent of scopes, objects had their destroy methods removed, because invoking them manually would lead to double-destroy errors. Instead, objects now add cleanup tasks to scopes directly, which has proven effective as a memory management strategy.
However, the lack of individual object destruction forces people to engage with Fusion's scope system and adopt it throughout their Fusion app. This is okay for islands of Fusion code, but less great for isolated use cases of Fusion.
So, as a gradual on-ramp to full usage of scopes, and a good compatibility measure to ensure that other memory management libraries can be used, I propose that objects should be able to remove themselves individually from the scope they're in via a destroy method on the object itself. This would not change the requirement to initialise an object with a scope.
This would be implemented by making each object insert a single inner scope, and cleaning up this inner scope when the object's destroy method is called. The object would be destroyed normally if the outer scope is destroyed.
This should also integrate with borrowed resources like Roblox instances, so that they remove themselves when they are individually destroyed.
The text was updated successfully, but these errors were encountered:
With the advent of scopes, objects had their destroy methods removed, because invoking them manually would lead to double-destroy errors. Instead, objects now add cleanup tasks to scopes directly, which has proven effective as a memory management strategy.
However, the lack of individual object destruction forces people to engage with Fusion's scope system and adopt it throughout their Fusion app. This is okay for islands of Fusion code, but less great for isolated use cases of Fusion.
So, as a gradual on-ramp to full usage of scopes, and a good compatibility measure to ensure that other memory management libraries can be used, I propose that objects should be able to remove themselves individually from the scope they're in via a
destroy
method on the object itself. This would not change the requirement to initialise an object with a scope.This would be implemented by making each object insert a single inner scope, and cleaning up this inner scope when the object's destroy method is called. The object would be destroyed normally if the outer scope is destroyed.
This should also integrate with borrowed resources like Roblox instances, so that they remove themselves when they are individually destroyed.
The text was updated successfully, but these errors were encountered: