3 ms·
> have the utility RAII class own both the object and the closure Yeah, but the ergonomics suck. Especially for random cleanup tasks that aren’t necessarily on
by ComputerGuru 5y ago
> have the utility RAII class own both the object and the closure
Yeah, but the ergonomics suck. Especially for random cleanup tasks that aren’t necessarily one-object, one-task.
The temp file thing was just an example, actual use case was more domain-specific.
- masklinn 5y ago> Yeah, but the ergonomics suck. Especially for random cleanup tasks that aren’t necessarily one-object, one-task. Doesn’t seem much more of a problem? Put a tuple in, get references out, cleanup gets the entire tuple. If lifetimes get complicated, use refcells and / or Rcs.