It would be nice if there were an inverse function of AnyExistentialContainer.projectValue() that accepts a pointer and does all the proper checks to read the correct number of bytes and store the value!
I see there are two initializers that take type metadata, but without this helper function we are left to reading how you implemented projectValue() to figure out how to store data in the container ourselves
Edit: after thinking about it more, maybe this should be a discussion, since it is not obvious to me how memory management of Any works for heap objects when you create it yourself… O_o Like, when is a HeapObject allocated for an Any container when the value isn't stored inline?
Can you convert this to a discussion for me @Azoy?
It would be nice if there were an inverse function of
AnyExistentialContainer.projectValue()that accepts a pointer and does all the proper checks to read the correct number of bytes and store the value!I see there are two initializers that take type metadata, but without this helper function we are left to reading how you implemented
projectValue()to figure out how to store data in the container ourselvesEdit: after thinking about it more, maybe this should be a discussion, since it is not obvious to me how memory management of
Anyworks for heap objects when you create it yourself… O_o Like, when is aHeapObjectallocated for anAnycontainer when the value isn't stored inline?Can you convert this to a discussion for me @Azoy?