Sorry to derail more off the topic here [1], but cannot this be done with Cassete.jl
+ the new tools of scope analysis? I mean, automating the insertion of memory management to replicate the C++ behaviour for some custom types.
(1) Maybe this is worth moving to its own thread, as @kristoffer.carlsson said, but I think that is only doable for stewards or someone with a role like that.