`Fusion.cleanup` should be renamed
Currently, Fusion api have cleanup and Cleanup for different usecases.
it is confusing to remember which one is which and easy to assume both functions are same
so I suggest renaming the cleanup to clean, which also sounds better when the other option is doNothing
A wild idea: it looks like ForKeys, ForValues and ForPairs accept a callable object, not just a function. So, it should be possible to add a __call metamethod to the Cleanup object and the user can simply pass it in, as-is.
A wild idea: it looks like
ForKeys,ForValuesandForPairsaccept a callable object, not just a function. So, it should be possible to add a__callmetamethod to theCleanupobject and the user can simply pass it in, as-is.
I don't think Elttob wants to use metatables for clarity, however it sounds like a good idea!
I veto any metatables, ever™.
(only half joking there. stick to simple primitives! metatables confuse junior devs)
By the way, I agree with this premise. Feel free to bikeshed names here.
I only named it this way because I cared more about having the thing implemented rather than making the prettiest variables :)
I would prefer that Cleanup gets renamed to OnDestroy. OnDestroy better matches the convention of the other event listener keys, and it more aptly describes the fact that it will call your destructor functions. I think cleanup is an acceptable name as it is, but doCleaning might be more consistent? Not sure if it's worth changing that one.
Call it doCleanup.
Call it
doCleanup.
I like that idea. It matches the doNothing name and also concisely indicates it's an action.
I would prefer that
Cleanupgets renamed toOnDestroy.OnDestroybetter matches the convention of the other event listener keys, and it more aptly describes the fact that it will call your destructor functions. I thinkcleanupis an acceptable name as it is, butdoCleaningmight be more consistent? Not sure if it's worth changing that one.
This is also a good point. I think it's worth changing both to help keep some good distance between them.
metatables confuse ~~junior~~ devs
:)
Late to the party here but was also having the same issue, it can be confusing.
I prefer doCleanup for performing the action, as it is easy to remember, and OnDestroy makes more sense than Cleanup
We'll rename it to doCleanup in v0.3. Thanks for the feedback everyone.
We'll rename it to
doCleanupin v0.3. Thanks for the feedback everyone.
Can't wait to be in the change log for suggesting a name.