Thanks Shu,
Interesting. I always thought of the C++ API as fairly complete but maybe I just always happened to use the bits that are there. Of course I could create a script that contains functions that C++ can call to create and update a WeakMap (no real use for a WeakSet, at the moment), it's just kinda yucky. While it's not hyper-critical for me, it seems a WeakMap would be a nice general purpose facility for C++ code to manage heap objects. In some sense, a WeakDataMap (maps Data rather than Value) might be even more useful though, of course, that would have no JS analogue.
My specific use case is that I want to map a Module object to my own JS object in a HostInitializeImportMetaObjectCallback callback (before calling a JS function). Of course, I can't do that because Module is Data not Value but I can use GetModuleNamespace to get a Value that maps one-to-one to Module so can be used in a WeakMap. Of course, if Module had an embedder settable/retrievable value, I wouldn't need a WeakMap but, like I said, it seems a WeakMap (or WeakDataMap) would be a useful, general-purpose C++ facility (though I agree people should use as little C++ as possible). And yes, I know there are lots of other ways to do what I want to do (I haven't looked at Node.js's approach, but it must have one), but the WeakMap approach seemed the tidiest.
Would it affect the decision whether to add WeakMap and WeakSet to the C++ API if I offered to do the work myself (I've contributed before)? Or is it not so much an effort/resource issue as an API bloat issue?
Thanks again